-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flake8_bugbear] message based on expression location [B015] #12944
Conversation
|
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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 B015
I also added another function to the test file, to see the message
if the comparison is not at the end of the scope