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
[MAINTENANCE] Enable SIM101
+ SIM114
#9758
Conversation
✅ Deploy Preview for niobium-lead-7998 canceled.
|
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9758 +/- ##
===========================================
+ Coverage 82.69% 82.70% +0.01%
===========================================
Files 512 512
Lines 46901 46885 -16
===========================================
- Hits 38783 38778 -5
+ Misses 8118 8107 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…ent" This reverts commit ba29c7a.
for more information, see https://pre-commit.ci
pyproject.toml
Outdated
# TODO: enable these a few at a time (ordered by number of violations) | ||
"SIM103", # needless-bool | ||
"SIM118", # in-dict-keys | ||
"SIM108", # if-else-block-instead-of-if-exp | ||
"SIM211", # if-expr-with-false-true | ||
"SIM102", # collapsible-if | ||
"SIM300", # yoda-conditions | ||
"SIM105", # suppressible-exception | ||
"SIM117", # multiple-with-statements | ||
"SIM201", # negate-equal-op | ||
"SIM110", # reimplemented-builtin | ||
"SIM910", # dict-get-with-none-default | ||
"SIM401", # if-else-block-instead-of-dict-get | ||
"SIM115", # open-file-with-context-handler | ||
"SIM202", # negate-not-equal-op | ||
"SIM210", # if-expr-with-true-false | ||
"SIM112", # uncapitalized-environment-variables |
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.
This ones still need to be enabled in followup PRs
flake8-simplify
part 1SIM101
+ SIM114
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.
LGTM!
I think tests/test_definitions/test_expectations_v3_api.py
could use some refactoring but I'm OK if that is not included here.
@@ -76,6 +76,14 @@ def __init__( # noqa: PLR0913 | |||
self.verify_that_key_to_filepath_operation_is_reversible() | |||
self._fixed_length_key = True | |||
|
|||
@staticmethod |
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 ok if we remove the @staticmethod
decorator or leave it. I don't have a strong argument either way.
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.
If it isn't relying on instance or class attributes I think it's better as a static method.
connection_string.account and connection_string.user and connection_string.password | ||
): | ||
) | ||
if is_connection_string or has_min_connection_detail_values: |
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.
Nice!
Part 1 of multiple PR's to enable the
SIM
rules.https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
Rules included