-
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
Make unnecessary-paren-on-raise-exception
an unsafe edit
#8231
Conversation
Ah, we can mark it as safe if we know it's a class or a builtin, I think. |
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+22, -22, 0 error(s)) airflow (+18, -18)
+ [*] 16237 fixable with the `--fix` option (6278 hidden fixes can be enabled with the `--unsafe-fixes` option). - [*] 16254 fixable with the `--fix` option (6261 hidden fixes can be enabled with the `--unsafe-fixes` option). + airflow/api_connexion/security.py:92:27: RSE102 Unnecessary parentheses on raised exception - airflow/api_connexion/security.py:92:27: RSE102 [*] Unnecessary parentheses on raised exception + airflow/auth/managers/fab/decorators/auth.py:59:35: RSE102 Unnecessary parentheses on raised exception - airflow/auth/managers/fab/decorators/auth.py:59:35: RSE102 [*] Unnecessary parentheses on raised exception + airflow/exceptions.py:230:22: RSE102 Unnecessary parentheses on raised exception - airflow/exceptions.py:230:22: RSE102 [*] Unnecessary parentheses on raised exception + airflow/models/dagcode.py:198:34: RSE102 Unnecessary parentheses on raised exception - airflow/models/dagcode.py:198:34: RSE102 [*] Unnecessary parentheses on raised exception + airflow/models/taskinstance.py:424:41: RSE102 Unnecessary parentheses on raised exception - airflow/models/taskinstance.py:424:41: RSE102 [*] Unnecessary parentheses on raised exception + airflow/models/taskinstance.py:907:38: RSE102 Unnecessary parentheses on raised exception - airflow/models/taskinstance.py:907:38: RSE102 [*] Unnecessary parentheses on raised exception + airflow/operators/python.py:418:43: RSE102 Unnecessary parentheses on raised exception - airflow/operators/python.py:418:43: RSE102 [*] Unnecessary parentheses on raised exception + airflow/providers/dbt/cloud/sensors/dbt.py:143:35: RSE102 Unnecessary parentheses on raised exception - airflow/providers/dbt/cloud/sensors/dbt.py:143:35: RSE102 [*] Unnecessary parentheses on raised exception + airflow/timetables/_cron.py:69:38: RSE102 Unnecessary parentheses on raised exception - airflow/timetables/_cron.py:69:38: RSE102 [*] Unnecessary parentheses on raised exception + tests/dags/test_on_failure_callback.py:44:31: RSE102 Unnecessary parentheses on raised exception - tests/dags/test_on_failure_callback.py:44:31: RSE102 [*] Unnecessary parentheses on raised exception + tests/decorators/test_python.py:815:39: RSE102 Unnecessary parentheses on raised exception - tests/decorators/test_python.py:815:39: RSE102 [*] Unnecessary parentheses on raised exception + tests/decorators/test_python.py:854:39: RSE102 Unnecessary parentheses on raised exception - tests/decorators/test_python.py:854:39: RSE102 [*] Unnecessary parentheses on raised exception + tests/models/test_taskinstance.py:1019:39: RSE102 Unnecessary parentheses on raised exception - tests/models/test_taskinstance.py:1019:39: RSE102 [*] Unnecessary parentheses on raised exception + tests/models/test_taskinstance.py:533:35: RSE102 Unnecessary parentheses on raised exception - tests/models/test_taskinstance.py:533:35: RSE102 [*] Unnecessary parentheses on raised exception + tests/models/test_taskinstance.py:757:39: RSE102 Unnecessary parentheses on raised exception - tests/models/test_taskinstance.py:757:39: RSE102 [*] Unnecessary parentheses on raised exception + tests/models/test_taskinstance.py:854:39: RSE102 Unnecessary parentheses on raised exception - tests/models/test_taskinstance.py:854:39: RSE102 [*] Unnecessary parentheses on raised exception + tests/models/test_taskinstance.py:953:39: RSE102 Unnecessary parentheses on raised exception - tests/models/test_taskinstance.py:953:39: RSE102 [*] Unnecessary parentheses on raised exception bokeh (+2, -2)
+ [*] 17799 fixable with the `--fix` option (4405 hidden fixes can be enabled with the `--unsafe-fixes` option). - [*] 17800 fixable with the `--fix` option (4404 hidden fixes can be enabled with the `--unsafe-fixes` option). + tests/unit/bokeh/server/views/test_ws.py:46:39: RSE102 Unnecessary parentheses on raised exception - tests/unit/bokeh/server/views/test_ws.py:46:39: RSE102 [*] Unnecessary parentheses on raised exception content (+2, -2)
+ Packs/SplunkPyPreRelease/Integrations/SplunkPyPreRelease/SplunkPyPreRelease_test.py:1445:34: RSE102 Unnecessary parentheses on raised exception - Packs/SplunkPyPreRelease/Integrations/SplunkPyPreRelease/SplunkPyPreRelease_test.py:1445:34: RSE102 [*] Unnecessary parentheses on raised exception + [*] 12923 fixable with the `--fix` option (5492 hidden fixes can be enabled with the `--unsafe-fixes` option). - [*] 12924 fixable with the `--fix` option (5491 hidden fixes can be enabled with the `--unsafe-fixes` option).
|
257d985
to
550f890
Compare
@zanieb - Gonna merge this, it's strictly safer (marking some cases as unsafe). |
/// Parentheses can only be omitted if the exception is a class, as opposed to | ||
/// a function call. This rule isn't always capable of distinguishing between | ||
/// the two. For example, if you define a method `get_exception` that itself | ||
/// returns an exception object, this rule will falsy mark the parentheses |
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.
/// returns an exception object, this rule will falsy mark the parentheses | |
/// returns an exception object, this rule will incorrectly mark the parentheses |
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.
I'm also a little confused as I thought function definitions were excluded?
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.
Improved in #8256, thank you!
Summary
This rule is now unsafe if we can't verify that the
obj
inraise obj()
is a class or builtin. (If we verify that it's a function, we don't raise at all, as before.)See the documentation change for motivation behind the unsafe edit.
Closes #8228.