[flake8_bugbear] message based on expression location [B015]#12944
Merged
MichaReiser merged 3 commits intoastral-sh:mainfrom Aug 17, 2024
Merged
[flake8_bugbear] message based on expression location [B015]#12944MichaReiser merged 3 commits intoastral-sh:mainfrom
MichaReiser merged 3 commits intoastral-sh:mainfrom
Conversation
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| B015 | 30 | 15 | 15 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+15 -15 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)
apache/airflow (+15 -15 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ tests/api_connexion/endpoints/test_dag_stats_endpoint.py:172:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/api_connexion/endpoints/test_dag_stats_endpoint.py:172:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/core/test_otel_logger.py:179:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/core/test_otel_logger.py:179:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/core/test_otel_logger.py:198:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/core/test_otel_logger.py:198:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/core/test_otel_logger.py:253:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/core/test_otel_logger.py:253:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/decorators/test_mapped.py:38:5: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/decorators/test_mapped.py:38:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/jobs/test_backfill_job.py:1999:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/jobs/test_backfill_job.py:1999:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/models/test_taskinstance.py:572:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/models/test_taskinstance.py:572:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/amazon/aws/operators/test_emr_serverless.py:112:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/amazon/aws/operators/test_emr_serverless.py:112:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/amazon/aws/operators/test_emr_serverless.py:235:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/amazon/aws/operators/test_emr_serverless.py:235:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/google/cloud/triggers/test_vertex_ai.py:415:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/google/cloud/triggers/test_vertex_ai.py:415:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/google/cloud/triggers/test_vertex_ai.py:555:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/google/cloud/triggers/test_vertex_ai.py:555:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/google/cloud/triggers/test_vertex_ai.py:705:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/google/cloud/triggers/test_vertex_ai.py:705:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/providers/google/cloud/triggers/test_vertex_ai.py:860:9: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/providers/google/cloud/triggers/test_vertex_ai.py:860:9: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/serialization/test_dag_serialization.py:2563:5: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/serialization/test_dag_serialization.py:2563:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it. + tests/utils/test_task_group.py:1428:5: B015 Pointless comparison at end of function scope. Did you mean to return the expression result? - tests/utils/test_task_group.py:1428:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it.
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| B015 | 30 | 15 | 15 | 0 | 0 |
MichaReiser
approved these changes
Aug 17, 2024
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks. I've a small suggestion to make the code a bit more resilient to AST/parser changes. But this otherwise looks good. Thank you
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
for issue #12617, display different
message if useless comparison is at the end of function scope.
Test Plan
cargo run -p ruff -- check crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B015.py --preview --no-cache --select B015I also added another function to the test file, to see the message
if the comparison is not at the end of the scope