-
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
Extend dict-get-with-none-default
(SIM910
) to non-literals
#8762
Merged
Conversation
This file contains 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
charliermarsh
force-pushed
the
charlie/SIM9
branch
from
November 18, 2023 23:51
a8c12a4
to
7f88e13
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
SIM910 | 12 | 12 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+842 -0 violations, +0 -0 fixes in 41 projects)
apache/airflow (+7 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --select ALL --preview
+ airflow/io/store/__init__.py:134:21: SIM910 [*] Use `_STORE_CACHE.get(alias)` instead of `_STORE_CACHE.get(alias, None)` + airflow/providers/amazon/aws/hooks/glue_crawler.py:126:32: SIM910 [*] Use `crawler_tags.get(key)` instead of `crawler_tags.get(key, None)` + airflow/providers/apache/livy/operators/livy.py:214:12: SIM910 [*] Use `event.get("log_lines")` instead of `event.get("log_lines", None)` + tests/hooks/test_package_index.py:70:24: SIM910 [*] Use `testdata.get("host")` instead of `testdata.get("host", None)` + tests/hooks/test_package_index.py:71:25: SIM910 [*] Use `testdata.get("login")` instead of `testdata.get("login", None)` + tests/hooks/test_package_index.py:72:28: SIM910 [*] Use `testdata.get("password")` instead of `testdata.get("password", None)` + tests/hooks/test_package_index.py:73:35: SIM910 [*] Use `testdata.get("expected_result")` instead of `testdata.get("expected_result", None)`
bokeh/bokeh (+4 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --select ALL --preview
+ src/bokeh/application/handlers/code_runner.py:108:25: SIM910 [*] Use `d.get('__doc__')` instead of `d.get('__doc__', None)` + src/bokeh/server/views/multi_root_static_handler.py:62:25: SIM910 [*] Use `root.get(name)` instead of `root.get(name, None)` + src/bokeh/sphinxext/bokeh_palette.py:113:9: SIM910 [*] Use `_globals.get("palette")` instead of `_globals.get("palette", None)` + src/bokeh/util/compiler.py:306:14: SIM910 [*] Use `_bundle_cache.get(key)` instead of `_bundle_cache.get(key, None)`
demisto/content (+803 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview
+ Documentation/common_server_docs.py:178:32: SIM910 [*] Use `PY_IRREGULAR_FUNCS.get(a)` instead of `PY_IRREGULAR_FUNCS.get(a, None)` + Documentation/common_server_docs.py:185:32: SIM910 [*] Use `PY_IRREGULAR_FUNCS.get(a)` instead of `PY_IRREGULAR_FUNCS.get(a, None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:304:19: SIM910 [*] Use `args.get('instance_id')` instead of `args.get('instance_id', None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:305:16: SIM910 [*] Use `args.get('port')` instead of `args.get('port', None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:306:16: SIM910 [*] Use `args.get('protocol')` instead of `args.get('protocol', None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:307:17: SIM910 [*] Use `args.get('public_ip')` instead of `args.get('public_ip', None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:308:19: SIM910 [*] Use `args.get('assume_role')` instead of `args.get('assume_role', None)` + Packs/AWS-Enrichment-Remediation/Scripts/AWSRecreateSG/AWSRecreateSG.py:309:14: SIM910 [*] Use `args.get('region')` instead of `args.get('region', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:100:26: SIM910 [*] Use `args.get('first_observed_at_start')` instead of `args.get('first_observed_at_start', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:101:24: SIM910 [*] Use `args.get('first_observed_at_end')` instead of `args.get('first_observed_at_end', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:103:29: SIM910 [*] Use `args.get('date_range_unit')` instead of `args.get('date_range_unit', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:109:26: SIM910 [*] Use `args.get('last_observed_at_start')` instead of `args.get('last_observed_at_start', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:110:24: SIM910 [*] Use `args.get('last_observed_at_end')` instead of `args.get('last_observed_at_end', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:112:29: SIM910 [*] Use `args.get('date_range_unit')` instead of `args.get('date_range_unit', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:116:26: SIM910 [*] Use `args.get('created_at_start')` instead of `args.get('created_at_start', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:117:24: SIM910 [*] Use `args.get('created_at_end')` instead of `args.get('created_at_end', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:119:29: SIM910 [*] Use `args.get('date_range_unit')` instead of `args.get('date_range_unit', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:123:26: SIM910 [*] Use `args.get('updated_at_start')` instead of `args.get('updated_at_start', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:124:24: SIM910 [*] Use `args.get('updated_at_end')` instead of `args.get('updated_at_end', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:126:29: SIM910 [*] Use `args.get('date_range_unit')` instead of `args.get('date_range_unit', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:130:26: SIM910 [*] Use `args.get('severity_label_value')` instead of `args.get('severity_label_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:131:31: SIM910 [*] Use `args.get('severity_label_comparison')` instead of `args.get('severity_label_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:135:26: SIM910 [*] Use `args.get('title_value')` instead of `args.get('title_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:136:31: SIM910 [*] Use `args.get('title_comparison')` instead of `args.get('title_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:140:26: SIM910 [*] Use `args.get('description_value')` instead of `args.get('description_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:141:31: SIM910 [*] Use `args.get('description_comparison')` instead of `args.get('description_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:145:26: SIM910 [*] Use `args.get('recommendation_text_value')` instead of `args.get('recommendation_text_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:146:31: SIM910 [*] Use `args.get('recommendation_text_comparison')` instead of `args.get('recommendation_text_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:150:26: SIM910 [*] Use `args.get('source_url_value')` instead of `args.get('source_url_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:151:31: SIM910 [*] Use `args.get('source_url_comparison')` instead of `args.get('source_url_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:155:24: SIM910 [*] Use `args.get('product_fields_key')` instead of `args.get('product_fields_key', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:156:26: SIM910 [*] Use `args.get('product_fields_value')` instead of `args.get('product_fields_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:157:31: SIM910 [*] Use `args.get('product_fields_comparison')` instead of `args.get('product_fields_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:161:26: SIM910 [*] Use `args.get('product_name_value')` instead of `args.get('product_name_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:162:31: SIM910 [*] Use `args.get('product_name_comparison')` instead of `args.get('product_name_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:166:26: SIM910 [*] Use `args.get('company_name_value')` instead of `args.get('company_name_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:167:31: SIM910 [*] Use `args.get('company_name_comparison')` instead of `args.get('company_name_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:171:24: SIM910 [*] Use `args.get('user_defined_fields_key')` instead of `args.get('user_defined_fields_key', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:172:26: SIM910 [*] Use `args.get('user_defined_fields_value')` instead of `args.get('user_defined_fields_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:173:31: SIM910 [*] Use `args.get('user_defined_fields_comparison')` instead of `args.get('user_defined_fields_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:177:26: SIM910 [*] Use `args.get('malware_name_value')` instead of `args.get('malware_name_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:178:31: SIM910 [*] Use `args.get('malware_name_comparison')` instead of `args.get('malware_name_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:182:26: SIM910 [*] Use `args.get('malware_type_value')` instead of `args.get('malware_type_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:183:31: SIM910 [*] Use `args.get('malware_type_comparison')` instead of `args.get('malware_type_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:187:26: SIM910 [*] Use `args.get('malware_path_value')` instead of `args.get('malware_path_value', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:188:31: SIM910 [*] Use `args.get('malware_path_comparison')` instead of `args.get('malware_path_comparison', None)` + Packs/AWS-SecurityHub/Integrations/AWS_SecurityHub/AWS_SecurityHub.py:192:26: SIM910 [*] Use `args.get('malware_state_value')` instead of `args.get('malware_state_value', None)` ... 756 additional changes omitted for project
ibis-project/ibis (+6 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --preview
+ ibis/backends/pandas/execution/temporal.py:123:11: SIM910 [*] Use `OFFSET_CLASS.get(unit)` instead of `OFFSET_CLASS.get(unit, None)` + ibis/backends/pandas/execution/temporal.py:135:11: SIM910 [*] Use `OFFSET_CLASS.get(unit)` instead of `OFFSET_CLASS.get(unit, None)` + ibis/backends/pandas/execution/temporal.py:147:11: SIM910 [*] Use `OFFSET_CLASS.get(unit)` instead of `OFFSET_CLASS.get(unit, None)` + ibis/backends/pandas/execution/temporal.py:159:11: SIM910 [*] Use `OFFSET_CLASS.get(unit)` instead of `OFFSET_CLASS.get(unit, None)` + ibis/backends/postgres/datatypes.py:76:25: SIM910 [*] Use `_postgres_interval_fields.get(field)` instead of `_postgres_interval_fields.get(field, None)` + ibis/backends/tests/test_map.py:194:46: SIM910 [*] Use `value.get(x)` instead of `value.get(x, None)`
... Truncated remaining completed projected reports due to GitHub comment length restrictions
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
SIM910 | 842 | 842 | 0 | 0 | 0 |
This needs to be gated behind |
charliermarsh
force-pushed
the
charlie/SIM9
branch
from
November 19, 2023 00:09
7f88e13
to
64f7c11
Compare
charliermarsh
added
rule
Implementing or modifying a lint rule
preview
Related to preview mode features
and removed
bug
Something isn't working
labels
Nov 19, 2023
charliermarsh
force-pushed
the
charlie/SIM9
branch
from
November 19, 2023 00:17
64f7c11
to
d0cdd58
Compare
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
Ensures that we can catch cases like:
Previously, the rule was somewhat useless, as it only checked for literal accesses.
Closes #8760.