Skip to content

Commit

Permalink
Change default for target-version option
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Nov 18, 2024
1 parent b8192f7 commit a57503d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ fn version_always_less_than(
};

Ok(if or_equal {
// Ex) `sys.version_info <= 3.9`. If Python 3.9 is the minimum supported version,
// Ex) `sys.version_info <= 3.8`. If Python 3.8 is the minimum supported version,
// the condition won't always evaluate to `false`, so we want to return `false`.
if_minor < py_minor
} else {
// Ex) `sys.version_info < 3.9`. If Python 3.9 is the minimum supported version,
// Ex) `sys.version_info < 3.8`. If Python 3.8 is the minimum supported version,
// the condition _will_ always evaluate to `false`, so we want to return `true`.
if_minor <= py_minor
})
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_workspace/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ pub struct Options {
/// file than it would for an equivalent runtime file with the same target
/// version.
#[option(
default = r#""py38""#,
value_type = r#""py37" | "py38" | "py39" | "py310" | "py311" | "py312""#,
default = r#""py39""#,
value_type = r#""py37" | "py38" | "py39" | "py310" | "py311" | "py312" | "py313""#,
example = r#"
# Always generate Python 3.7-compatible code.
target-version = "py37"
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ If left unspecified, Ruff's default configuration is equivalent to:
line-length = 88
indent-width = 4

# Assume Python 3.8
target-version = "py38"
# Assume Python 3.9
target-version = "py39"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
Expand Down

0 comments on commit a57503d

Please sign in to comment.