-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Comparing changes
Open a pull request
base repository: astral-sh/ruff
base: v0.0.276
head repository: astral-sh/ruff
compare: v0.0.277
- 15 commits
- 112 files changed
- 7 contributors
Commits on Jul 3, 2023
-
Don't add a magic trailing comma for a single entry (#5463)
## Summary If a comma separated list has only one entry, black will respect the magic trailing comma, but it will not add a new one. The following code will remain as is: ```python b1 = [ aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa ] b2 = [ aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa, ] b3 = [ aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa, aksjdhflsakhdflkjsadlfajkslhfdkjsaldajlahflashdfljahlfksajlhfajfjfsaahflakjslhdfkjalhdskjfa ] ``` ## Test Plan This was first discovered in https://github.com/django/django/blob/7eeadc82c2f7d7a778e3bb43c34d642e6275dacf/django/contrib/admin/checks.py#L674-L681, which i've minimized into a call test. I've added tests for the three cases (one entry + no comma, one entry + comma, more than one entry) to the list tests. The diffs from the black tests get smaller.
Configuration menu - View commit details
-
Copy full SHA for a647f31 - Browse repository at this point
Copy the full SHA a647f31View commit details -
Turn Linters', etc. implicit
into_iter()
s into explicitrules()
(#……5436) ## Summary As discussed on ~IRC~ Discord, this will make it easier for e.g. the docs generation stuff to get all rules for a linter (using `all_rules()`) instead of just non-nursery ones, and it also makes it more Explicit Is Better Than Implicit to iterate over linter rules. Grepping for `Item = Rule` reveals some remaining implicit `IntoIterator`s that I didn't feel were necessarily in scope for this (and honestly, iterating over a `RuleSet` makes sense).
Configuration menu - View commit details
-
Copy full SHA for 6acc316 - Browse repository at this point
Copy the full SHA 6acc316View commit details
Commits on Jul 4, 2023
-
Format import statements (#5493)
## Summary Format import statements in all their variants. Specifically, this implemented formatting `StmtImport`, `StmtImportFrom` and `Alias`. ## Test Plan I added some custom snapshots, even though this has been covered well by black's tests.
Configuration menu - View commit details
-
Copy full SHA for 787e2fd - Browse repository at this point
Copy the full SHA 787e2fdView commit details -
check-formatter-stability: Remove newlines and add
--error-file
(#5491) ## Summary This makes the output of `check-formatter-stability` more concise by removing extraneous newlines. It also adds a `--error-file` option to that script that allows creating a file with just the errors (without the status messages) to share with others. ## Test Plan I ran it over CPython and looked at the output. I then added the `--error-file` option and looked at the contents of the file
Configuration menu - View commit details
-
Copy full SHA for 937de12 - Browse repository at this point
Copy the full SHA 937de12View commit details -
Add unreachable code rule (#5384)
Co-authored-by: Thomas de Zeeuw <[email protected]> Co-authored-by: Micha Reiser <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0b963dd - Browse repository at this point
Copy the full SHA 0b963ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 521e6de - Browse repository at this point
Copy the full SHA 521e6deView commit details -
Configuration menu - View commit details
-
Copy full SHA for 75da72b - Browse repository at this point
Copy the full SHA 75da72bView commit details -
Avoid PERF rules for iteration-dependent assignments (#5508)
Configuration menu - View commit details
-
Copy full SHA for c395e44 - Browse repository at this point
Copy the full SHA c395e44View commit details -
[
pylint
] Implement Pylinttypevar-name-mismatch
(C0132
) (#5501)## Summary Implement Pylint `typevar-name-mismatch` (`C0132`) as `type-param-name-mismatch` (`PLC0132`). Includes documentation. Related to #970. The Pylint implementation checks only `TypeVar`, but this PR checks `TypeVarTuple`, `ParamSpec`, and `NewType` as well. This seems to better represent the Pylint rule's [intended behaviour](pylint-dev/pylint#5224). Full disclosure: I am not a fan of the translated name and think it should probably be different. ## Test Plan `cargo test`
Configuration menu - View commit details
-
Copy full SHA for 0e67757 - Browse repository at this point
Copy the full SHA 0e67757View commit details -
Merge clippy and clippy (wasm) jobs on CI (#5447)
## Summary The clippy wasm job rarely fails if regular clippy doesn't, wasm clippy still compiles a lot of native dependencies for the proc macro and we have less CI jobs overall, so i think this an improvement to our CI. ```shell $ CARGO_TARGET_DIR=target-wasm cargo clippy -p ruff_wasm --target wasm32-unknown-unknown --all-features -j 2 -- -D warnings $ du -sh target-wasm/* 12K target-wasm/CACHEDIR.TAG 582M target-wasm/debug 268M target-wasm/wasm32-unknown-unknown ``` ## Test plan n/a
Configuration menu - View commit details
-
Copy full SHA for 0a26201 - Browse repository at this point
Copy the full SHA 0a26201View commit details -
Avoid returning first-match for rule prefixes (#5511)
Closes #5495, but there's a TODO here to improve this further. The current `from_code` implementation feels really indirect.
Configuration menu - View commit details
-
Copy full SHA for 952c623 - Browse repository at this point
Copy the full SHA 952c623View commit details -
Add
ruff rule --all
subcommand (with JSON output) (#5059)## Summary This adds a `ruff rule --all` switch that prints out a human-readable Markdown or a machine-readable JSON document of the lint rules known to Ruff. I needed a machine-readable document of the rules [for a project](#5078), and figured it could be useful for other people – or tooling! – to be able to interrogate Ruff about its arcane knowledge. The JSON output is an array of the same objects printed by `ruff rule --format=json`. ## Test Plan I ran `ruff rule --all --format=json`. I think more might be needed, but maybe a snapshot test is overkill?
Configuration menu - View commit details
-
Copy full SHA for d7214e7 - Browse repository at this point
Copy the full SHA d7214e7View commit details -
Tweak prefix match to use .all_rules() (#5512)
## Summary No behavior change, but I think this is a little cleaner.
Configuration menu - View commit details
-
Copy full SHA for 485d997 - Browse repository at this point
Copy the full SHA 485d997View commit details -
Add .ipynb_checkpoints, .pyenv, .pytest_cache, and .vscode to default…
… excludes (#5513) ## Summary VS Code extensions are [recommended](https://code.visualstudio.com/docs/python/settings-reference#_linting-settings) to exclude `.vscode` and `site-packages`. Black also now omits `.vscode`, `.pytest_cache`, and `.ipynb_checkpoints` by default. Omitting `.pyenv` is similar to omitting virtual environments, but really only matters in the context of VS Code (see: #5509). Closes: #5510.
Configuration menu - View commit details
-
Copy full SHA for da1c320 - Browse repository at this point
Copy the full SHA da1c320View commit details -
Configuration menu - View commit details
-
Copy full SHA for 324455f - Browse repository at this point
Copy the full SHA 324455fView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v0.0.276...v0.0.277