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.0.271
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.0.272
Choose a head ref
  • 19 commits
  • 208 files changed
  • 7 contributors

Commits on Jun 7, 2023

  1. Configuration menu
    Copy the full SHA
    780d153 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b56a799 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b9060ea View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ec609f5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    222ca98 View commit details
    Browse the repository at this point in the history
  6. Correctly handle newlines after/before comments (#4895)

    <!--
    Thank you for contributing to Ruff! To help us out with reviewing, please consider the following:
    
    - Does this pull request include a summary of the change? (See below.)
    - Does this pull request include a descriptive title?
    - Does this pull request include references to any relevant issues?
    -->
    
    ## Summary
    
    This issue fixes the removal of empty lines between a leading comment and the previous statement:
    
    ```python
    a  = 20
    
    # leading comment
    b = 10
    ```
    
    Ruff removed the empty line between `a` and `b` because:
    * The leading comments formatting does not preserve leading newlines (to avoid adding new lines at the top of a body)
    * The `JoinNodesBuilder` counted the lines before `b`, which is 1 -> Doesn't insert a new line
    
    This is fixed by changing the `JoinNodesBuilder` to count the lines instead *after* the last node. This correctly gives 1, and the `# leading comment` will insert the empty lines between any other leading comment or the node.
    
    
    
    ## Test Plan
    
    I added a new test for empty lines.
    MichaReiser authored Jun 7, 2023
    Configuration menu
    Copy the full SHA
    6ab3fc6 View commit details
    Browse the repository at this point in the history
  7. Create fuzzers for testing correctness of parsing, linting and fixing (

    …#4822)
    
    Co-authored-by: Micha Reiser <micha@reiser.io>
    addisoncrump and MichaReiser authored Jun 7, 2023
    Configuration menu
    Copy the full SHA
    2f125f4 View commit details
    Browse the repository at this point in the history
  8. Replace verbatim text with NOT_YET_IMPLEMENTED (#4904)

    <!--
    Thank you for contributing to Ruff! To help us out with reviewing, please consider the following:
    
    - Does this pull request include a summary of the change? (See below.)
    - Does this pull request include a descriptive title?
    - Does this pull request include references to any relevant issues?
    -->
    
    ## Summary
    
    This PR replaces the `verbatim_text` builder with a `not_yet_implemented` builder that emits `NOT_YET_IMPLEMENTED_<NodeKind>` for not yet implemented nodes. 
    
    The motivation for this change is that partially formatting compound statements can result in incorrectly indented code, which is a syntax error:
    
    ```python
    def func_no_args():
      a; b; c
      if True: raise RuntimeError
      if False: ...
      for i in range(10):
        print(i)
        continue
    ```
    
    Get's reformatted to
    
    ```python
    def func_no_args():
        a; b; c
        if True: raise RuntimeError
        if False: ...
        for i in range(10):
        print(i)
        continue
    ```
    
    because our formatter does not yet support `for` statements and just inserts the text from the source. 
    
    ## Downsides
    
    Using an identifier will not work in all situations. For example, an identifier is invalid in an `Arguments ` position. That's why I kept `verbatim_text` around and e.g. use it in the `Arguments` formatting logic where incorrect indentations are impossible (to my knowledge). Meaning, `verbatim_text` we can opt in to `verbatim_text` when we want to iterate quickly on nodes that we don't want to provide a full implementation yet and using an identifier would be invalid. 
    
    ## Upsides
    
    Running this on main discovered stability issues with the newline handling that were previously "hidden" because of the verbatim formatting. I guess that's an upside :)
    
    ## Test Plan
    
    None?
    MichaReiser authored Jun 7, 2023
    Configuration menu
    Copy the full SHA
    bcf745c View commit details
    Browse the repository at this point in the history
  9. Use taiki-e/install-action to install cargo fuzz (#4928)

    * Use taiki-e/install-action to install cargo fuzz
    
    The cargo fuzz run seems to sometimes fail for unclear reasons (https://github.com/charliermarsh/ruff/actions/runs/5200348677/jobs/9379742606?pr=4900). I hope that this might fix it. I'll push more commits to this PR to check the caching behaviour.
    
    * Trigger CI with cache
    
    * Change cache
    
    * Actually use caching
    
    * Undo cargo update
    
    * cargo update fuzzer
    
    * Revert rust changes
    konstin authored Jun 7, 2023
    Configuration menu
    Copy the full SHA
    5c48414 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f990d9d View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    20240fc View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    ae75b30 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    6950c93 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f17282d View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a6d269f View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2023

  1. Configuration menu
    Copy the full SHA
    ac4a4da View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    01d3d4b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5235977 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4b78141 View commit details
    Browse the repository at this point in the history
Loading