[pycodestyle] Do not trigger E225 and E275 when the next token is a ')'#10315
Merged
charliermarsh merged 5 commits intoastral-sh:mainfrom Mar 11, 2024
Merged
[pycodestyle] Do not trigger E225 and E275 when the next token is a ')'#10315charliermarsh merged 5 commits intoastral-sh:mainfrom
pycodestyle] Do not trigger E225 and E275 when the next token is a ')'#10315charliermarsh merged 5 commits intoastral-sh:mainfrom
Conversation
c886689 to
c2c3949
Compare
c2c3949 to
f9ffa80
Compare
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| S311 | 6 | 6 | 0 | 0 | 0 |
| S605 | 1 | 1 | 0 | 0 | 0 |
| S607 | 1 | 1 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+8 -0 violations, +0 -0 fixes in 4 projects; 39 projects unchanged)
DisnakeDev/disnake (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ disnake/backoff.py:45:16: S311 Standard pseudo-random generators are not suitable for cryptographic purposes + disnake/colour.py:135:44: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
apache/airflow (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ airflow/dag_processing/manager.py:1156:13: S311 Standard pseudo-random generators are not suitable for cryptographic purposes + tests/dag_processing/test_job_runner.py:363:9: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
model-bakers/model_bakery (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ model_bakery/random_gen.py:30:16: S311 Standard pseudo-random generators are not suitable for cryptographic purposes
zulip/zulip (+3 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ analytics/lib/fixtures.py:39:11: S311 Standard pseudo-random generators are not suitable for cryptographic purposes + tools/lib/provision.py:280:60: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell` + tools/lib/provision.py:280:60: S607 Starting a process with a partial executable path
Changes by rule (3 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| S311 | 6 | 6 | 0 | 0 | 0 |
| S605 | 1 | 1 | 0 | 0 | 0 |
| S607 | 1 | 1 | 0 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
charliermarsh
approved these changes
Mar 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10295.
E225(Missing whitespace around operator) andE275(Missing whitespace after keyword) try to add a white space even when the next character is a)(which is a syntax error in most cases, the exceptions already being handled). This causesE202(Whitespace before close bracket) to try to remove the added whitespace, resulting in an infinite loop whenE225/E275re-add it.This PR adds an exception in
E225andE275to not trigger in case the next token is a). It is a bit simplistic, but it solves the example given in the issue without introducing a change in behavior (according to the fixtures).Test Plan
cargo testand theruff-ecosystemcheck were used to check that the PR's changes do not have side-effects.A new fixture was added to check that running the 3 rules on the example given in the issue does not cause ruff to fail to converge.