Make unnecessary-paren-on-raise-exception an unsafe edit#8231
Merged
charliermarsh merged 1 commit intomainfrom Oct 26, 2023
Merged
Make unnecessary-paren-on-raise-exception an unsafe edit#8231charliermarsh merged 1 commit intomainfrom
unnecessary-paren-on-raise-exception an unsafe edit#8231charliermarsh merged 1 commit intomainfrom
Conversation
Member
Author
|
Ah, we can mark it as safe if we know it's a class or a builtin, I think. |
Contributor
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
Member
Author
|
@zanieb - Gonna merge this, it's strictly safer (marking some cases as unsafe). |
zanieb
reviewed
Oct 26, 2023
| /// 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 |
Member
There was a problem hiding this comment.
Suggested change
| /// returns an exception object, this rule will falsy mark the parentheses | |
| /// returns an exception object, this rule will incorrectly mark the parentheses |
Member
There was a problem hiding this comment.
I'm also a little confused as I thought function definitions were excluded?
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
This rule is now unsafe if we can't verify that the
objinraise 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.