Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.2.0 #9680

Merged
merged 23 commits into from
Feb 1, 2024
Merged

Release v0.2.0 #9680

merged 23 commits into from
Feb 1, 2024

Commits on Feb 1, 2024

  1. Configuration menu
    Copy the full SHA
    c072707 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5dba038 View commit details
    Browse the repository at this point in the history
  3. [flake8-pyi] Mark unaliased-collections-abc-set-import fix as safe (

    #9679)
    
    ## Summary
    
    Prompted by
    #8482 (comment).
    The rename is only unsafe when the symbol is exported, so we can narrow
    the conditions.
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    0b800a9 View commit details
    Browse the repository at this point in the history
  4. Recategorize static-key-dict-comprehension from RUF011 to B035 (#…

    …9428)
    
    ## Summary
    
    This rule was added to flake8-bugbear. In general, we tend to prefer
    redirecting to prominent plugins when our own rules are reimplemented
    (since more projects have `B` activated than `RUF`).
    
    ## Test Plan
    
    `cargo test`
    # Conflicts:
    #	crates/ruff_linter/src/rules/ruff/rules/mod.rs
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    e210c3c View commit details
    Browse the repository at this point in the history
  5. Remove preview gating for newly-added stable fixes (#9681)

    ## Summary
    
    At present, our versioning policy forbids the addition of safe fixes to
    stable rules outside of a minor release, so we've accumulated a bunch of
    new fixes that are behind `--preview`, and can be ungated in v0.2.0.
    
    To find these, I just grepped for `preview.is_enabled()` and identified
    all such cases. I then audited the `preview_rules` test fixtures and
    removed any tests that existed only to test this autofix behavior.
    # Conflicts:
    #	crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap
    #	crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__preview__SIM114_SIM114.py.snap
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    d81a76d View commit details
    Browse the repository at this point in the history
  6. Remove preview gating for pycodestyle rules (#9685)

    ## Summary
    
    Un-gates the behavior to allow `sys.path` modifications between imports,
    which removed a bunch of false positives in the ecosystem CI at the
    time.
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    e201f45 View commit details
    Browse the repository at this point in the history
  7. Remove preview gating for flake8-pie rules (#9684)

    ## Summary
    
    Both of the preview behaviors gated here seem like improvements, so
    let's make them stable in v0.2.0
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    2b6e093 View commit details
    Browse the repository at this point in the history
  8. Remove preview gating for flake8-simplify rules (#9686)

    ## Summary
    
    Un-gates detecting `dict.get` rewrites in `if` expressions (rather than
    just `if` statements).
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    60dd138 View commit details
    Browse the repository at this point in the history
  9. Replace --show-source and --no-show-source with `--output_format=…

    …<full|concise>` (#9687)
    
    Fixes #7350
    
    ## Summary
    
    * `--show-source` and `--no-show-source` are now deprecated.
    * `output-format` supports two new variants, `full` and `concise`.
    `text` is now a deprecated variant, and any use of it is treated as the
    default serialization format.
    * `--output-format` now default to `concise`
    * In preview mode, `--output-format` defaults to `full`
    * `--show-source` will still set `--output-format` to `full` if the
    output format is not otherwise specified.
    * likewise, `--no-show-source` can override an output format that was
    set in a file-based configuration, though it will also be overridden by
    `--output-format`
    
    ## Test Plan
    
    A lot of tests were updated to use `--output-format=full`. Additional
    tests were added to ensure the correct deprecation warnings appeared,
    and that deprecated options behaved as intended.
    # Conflicts:
    #	crates/ruff/tests/integration_test.rs
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    0001350 View commit details
    Browse the repository at this point in the history
  10. Error if nursery rules are selected without preview (#9683)

    Extends #9682 to error if the nursery selector is used or nursery rules
    are selected without preview.
    
    Part of #7992 — we will remove this in 0.3.0 instead so we can provide
    nice errors in 0.2.0.
    # Conflicts:
    #	crates/ruff/tests/integration_test.rs
    #	crates/ruff_workspace/src/configuration.rs
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7c644d5 View commit details
    Browse the repository at this point in the history
  11. Always request the concise output format during ecosystem checks (#9708)

    Fixes a regression in the ecosystem checks from
    #9687 which was causing them to
    run for multiple hours due to the size of the output.
    
    We need the concise format for comparisons.
    
    We should probably update the ecosystem checks to actually diff the full
    output in the future because that'd be nice.
    # Conflicts:
    #	python/ruff-ecosystem/ruff_ecosystem/projects.py
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7574b57 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5b9132b View commit details
    Browse the repository at this point in the history
  13. Add rule deprecation infrastructure (#9689)

    Adds a new `Deprecated` rule group in addition to `Stable` and
    `Preview`.
    
    Deprecated rules:
    - Warn on explicit selection without preview
    - Error on explicit selection with preview
    - Are excluded when selected by prefix with preview
    
    Deprecates `TRY200`, `ANN101`, and `ANN102` as a proof of concept. We
    can consider deprecating them separately.
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    542d5f1 View commit details
    Browse the repository at this point in the history
  14. Add rule removal infrastructure (#9691)

    Similar to #9689 — retains removed
    rules for better error messages and documentation but removed rules
    _cannot_ be used in any context.
    
    Removes PLR1706 as a useful test case and something we want to
    accomplish in #9680 anyway. The rule was in preview so we do not need to
    deprecate it first.
    
    Closes #9007
    
    ## Test plan
    
    <img width="1110" alt="Rules table"
    src="https://github.com/astral-sh/ruff/assets/2586601/ac9fa682-623c-44aa-8e51-d8ab0d308355">
    
    <img width="1110" alt="Rule page"
    src="https://github.com/astral-sh/ruff/assets/2586601/05850b2d-7ca5-49bb-8df8-bb931bab25cd">
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    8620c6a View commit details
    Browse the repository at this point in the history
  15. Stabilize some rules for v0.2.0 release (#9712)

    ## Summary
    
    This PR stabilizes the preview rules from:
    
    - `flake8-trio` (6 rules)
    - `flake8-quotes` (1 rule)
    - `pyupgrade` (1 rule)
    - `flake8-pyi` (1 rule)
    - `flake8-simplify` (2 rules)
    - `flake8-bandit` (9 rules; 14 remain in preview)
    - `flake8-type-checking` (1 rule)
    - `numpy` (1 rule)
    - `ruff` (4 rules, one elevated from nursery; 6 remain in preview as
    they were added within the last 30 days)
    - `flake8-logging` (4 rules)
    
    I see these are largely uncontroversial.
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    c1e6732 View commit details
    Browse the repository at this point in the history
  16. Recategorize runtime-string-union to TCH010 (#9721)

    ## Summary
    
    This rule was added to `flake8-type-checking` as `TC010`. We're about to
    stabilize it, so we might as well use the correct code.
    
    See: #9573.
    charliermarsh authored and zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    28672fe View commit details
    Browse the repository at this point in the history
  17. Fix bug where selection included deprecated rules during preview (#9746)

    Cherry-picked from #9714 which is
    being abandoned for now because we need to invest more into our
    redirection infrastructure before it is feasible.
    
    Fixes a bug in the implementation where we improperly included
    deprecated rules in `RuleSelector.rules()` when preview is on. Includes
    some clean-up of error messages and the implementation.
    # Conflicts:
    #	crates/ruff/tests/integration_test.rs
    zanieb committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    1fb6ea6 View commit details
    Browse the repository at this point in the history
  18. Use fake rules for testing deprecation and removal infrastructure (#9752

    )
    
    Updates #9689 and #9691 to use rule testing infrastructure from #9747
    zanieb authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    dcc69f2 View commit details
    Browse the repository at this point in the history
  19. Add tests for redirected rules (#9754)

    Extends #9752 adding internal test
    rules for redirection
    
    Fixes a bug where we did not see warnings for exact codes that are
    redirected (just prefixes)
    zanieb authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    003a360 View commit details
    Browse the repository at this point in the history
  20. Redirect TRY200 to B904 (#9755)

    Follow-up to #9754 and #9689. Alternative to #9714.
    
    Marks `TRY200` as removed and redirects to `B904` instead of marking as
    deprecated and suggesting `B904` instead.
    zanieb authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    f6812ee View commit details
    Browse the repository at this point in the history
  21. Redirect PHG001 to S307 and PGH002 to G010 (#9756)

    Follow-up to #9754 and #9689. Alternative to #9714.
    Replaces #7506 and #7507
    Same ideas as #9755
    Part of #8931
    zanieb authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    8c18fc7 View commit details
    Browse the repository at this point in the history
  22. Restore RUF011 documentation (#9758)

    For consistency with other redirected rules as in
    #9755
    
    Follow-up to #9428
    zanieb authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    386035f View commit details
    Browse the repository at this point in the history
  23. Remove stale preview documentation from stabilized rule behaviors (#9759

    )
    
    These behaviors were stabilized, so the docs referring to them as
    preview-only are incorrect.
    charliermarsh authored Feb 1, 2024
    Configuration menu
    Copy the full SHA
    6769cee View commit details
    Browse the repository at this point in the history