Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: astral-sh/ruff
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.4.0
Choose a base ref
...
head repository: astral-sh/ruff
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.4.1
Choose a head ref
  • 11 commits
  • 49 files changed
  • 6 contributors

Commits on Apr 18, 2024

  1. Allow NoReturn-like functions for __str__, __len__, etc. (#11017)

    ## Summary
    
    If the method always raises, we shouldn't raise a diagnostic for
    "returning a value of the wrong type".
    
    Closes #11016.
    charliermarsh authored Apr 18, 2024
    Configuration menu
    Copy the full SHA
    33529c0 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2024

  1. Configuration menu
    Copy the full SHA
    5d3c9f2 View commit details
    Browse the repository at this point in the history
  2. [pylint] Implement invalid-hash-returned (PLE0309) (#10961)

    Add pylint rule invalid-hash-returned (PLE0309)
    
    See #970 for rules
    
    Test Plan: `cargo test`
    
    TBD: from the description: "Strictly speaking `bool` is a subclass of
    `int`, thus returning `True`/`False` is valid. To be consistent with
    other rules (e.g.
    [PLE0305](#10962)
    invalid-index-returned), ruff will raise, compared to pylint which will
    not raise."
    tibor-reiss authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    adf63d9 View commit details
    Browse the repository at this point in the history
  3. ENH: Bump ruff dependency versions to support the latest release of…

    … `v0.4.0` and Python 3.12 (#11025)
    
    ## Summary
    
    With the release of
    [`v0.4.0`](https://github.com/astral-sh/ruff/releases/tag/v0.4.0) of
    `ruff`, I noticed that some of `ruff`'s dependencies were not updated to
    their latest versions. The
    [`ruff-pre-commit`](https://github.com/astral-sh/ruff-pre-commit)
    package released
    [`v0.4.0`](https://github.com/astral-sh/ruff-pre-commit/releases/tag/v0.4.0)
    at the same time `ruff` was updated, but `ruff` still referenced
    `v0.3.7` of the package, not the newly updated version. I updated the
    `ruff-pre-commit` reference to be `v0.4.0`.
    
    In a similar light, I noticed that the version of the
    [`dill`](https://github.com/uqfoundation/dill) package being used was
    not the latest version. I bumped `dill` from version `0.3.7` to `0.3.8`,
    which now [fully supports Python
    3.12](https://github.com/uqfoundation/dill/releases/tag/0.3.8).
    
    ## Related Issues
    
    Resolves #11024
    HenryAsa authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    97acf1d View commit details
    Browse the repository at this point in the history
  4. [pylint] Implement invalid-index-returned (PLE0305) (#10962)

    Add pylint rule invalid-index-returned (PLE0305)
    
    See #970 for rules
    
    Test Plan: `cargo test`
    tibor-reiss authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    27902b7 View commit details
    Browse the repository at this point in the history
  5. [ruff] Ignore stub functions in unused-async (RUF029) (#11026)

    ## Summary
    
    We should ignore methods that appear to be stubs, e.g.:
    
    ```python
    async def foo() -> int: ...
    ```
    
    Closes #11018.
    charliermarsh authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    06c248a View commit details
    Browse the repository at this point in the history
  6. Expect indented case block instead of match stmt (#11033)

    ## Summary
    
    This PR adds a new `Clause::Case` and uses it to parse the body of a
    `case` block. Earlier, it was using `Match` which would give an
    incorrect error message like:
    
    ```
      |
    1 | match subject:
    2 |     case 1:
    3 |     case 2: ...
      |     ^^^^ Syntax Error: Expected an indented block after `match` statement
      |
    ```
    
    ## Test Plan
    
    Add test case and update the snapshot.
    dhruvmanila authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    9bb23b0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9b80cc0 View commit details
    Browse the repository at this point in the history
  8. Use empty range when there's "gap" in token source (#11032)

    ## Summary
    
    This fixes a bug where the parser would panic when there is a "gap" in
    the token source.
    
    What's a gap?
    
    The reason it's `<=` instead of just `==` is because there could be
    whitespaces between
    the two tokens. For example:
    
    ```python
    #     last token end
    #     | current token (newline) start
    #     v v
    def foo \n
    #      ^
    #      assume there's trailing whitespace here
    ```
    
    Or, there could tokens that are considered "trivia" and thus aren't
    emitted by the token
    source. These are comments and non-logical newlines. For example:
    
    ```python
    #     last token end
    #     v
    def foo # comment\n
    #                ^ current token (newline) start
    ```
    
    In either of the above cases, there's a "gap" between the end of the
    last token and start
    of the current token.
    
    ## Test Plan
    
    Add test cases and update the snapshots.
    dhruvmanila authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    d3cd61f View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    34873ec View commit details
    Browse the repository at this point in the history
  10. Bump version to 0.4.1 (#11035)

    Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
    dhruvmanila and AlexWaygood authored Apr 19, 2024
    Configuration menu
    Copy the full SHA
    0ff25a5 View commit details
    Browse the repository at this point in the history
Loading