-
Notifications
You must be signed in to change notification settings - Fork 903
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
feat: distinguish * and ** in globs #11139
base: main
Are you sure you want to change the base?
Conversation
I think I'm cool with changing this but it should probably be considered a breaking change (since files that were ignored will now be unignored). |
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.
Yes, completely agree with this being a breaking change.
I noticed a couple of tests failed in CI, which I will investigate now and see if I can get them to pass.
Update: The default include
glob had to be updated to **/*.py
and **/*.pyi
. All CI tests are now passing.
fbc9f82
to
6b0f6d6
Compare
By default, the `globset` crate matches files as per the `.gitignore` specifications which results in `foo/*.py` matching `foo/hello.py` as well as `foo/bar/hello.py`. This commit changes this by setting the `literal_separator` option to `true`, which ensures that `*` and `?` never match a path separator. Signed-off-by: JP-Ellis <josh@jpellis.me>
6b0f6d6
to
58891f6
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
S101 | 19886 | 19886 | 0 | 0 | 0 |
D102 | 11929 | 11929 | 0 | 0 | 0 |
D103 | 2741 | 2741 | 0 | 0 | 0 |
D101 | 2242 | 2242 | 0 | 0 | 0 |
D212 | 1893 | 1893 | 0 | 0 | 0 |
D100 | 1694 | 1694 | 0 | 0 | 0 |
D400 | 1514 | 1514 | 0 | 0 | 0 |
D415 | 1509 | 1509 | 0 | 0 | 0 |
S113 | 1250 | 1250 | 0 | 0 | 0 |
D200 | 930 | 930 | 0 | 0 | 0 |
D205 | 853 | 853 | 0 | 0 | 0 |
D104 | 693 | 693 | 0 | 0 | 0 |
NPY002 | 476 | 476 | 0 | 0 | 0 |
D401 | 403 | 403 | 0 | 0 | 0 |
T201 | 325 | 325 | 0 | 0 | 0 |
D202 | 247 | 247 | 0 | 0 | 0 |
D107 | 122 | 122 | 0 | 0 | 0 |
FLY002 | 122 | 122 | 0 | 0 | 0 |
D404 | 86 | 86 | 0 | 0 | 0 |
S311 | 80 | 80 | 0 | 0 | 0 |
E501 | 65 | 65 | 0 | 0 | 0 |
D105 | 62 | 62 | 0 | 0 | 0 |
RUF012 | 54 | 54 | 0 | 0 | 0 |
D403 | 47 | 47 | 0 | 0 | 0 |
TRY002 | 37 | 37 | 0 | 0 | 0 |
D209 | 36 | 36 | 0 | 0 | 0 |
B028 | 35 | 35 | 0 | 0 | 0 |
A001 | 33 | 0 | 33 | 0 | 0 |
N806 | 16 | 16 | 0 | 0 | 0 |
B018 | 16 | 0 | 16 | 0 | 0 |
TID253 | 15 | 15 | 0 | 0 | 0 |
TID252 | 15 | 15 | 0 | 0 | 0 |
INP001 | 15 | 15 | 0 | 0 | 0 |
N802 | 15 | 15 | 0 | 0 | 0 |
TID251 | 13 | 13 | 0 | 0 | 0 |
S105 | 13 | 13 | 0 | 0 | 0 |
S108 | 11 | 11 | 0 | 0 | 0 |
UP031 | 11 | 7 | 4 | 0 | 0 |
A002 | 11 | 0 | 11 | 0 | 0 |
T203 | 9 | 9 | 0 | 0 | 0 |
RET504 | 9 | 9 | 0 | 0 | 0 |
B011 | 6 | 6 | 0 | 0 | 0 |
N803 | 6 | 6 | 0 | 0 | 0 |
B008 | 5 | 5 | 0 | 0 | 0 |
PERF203 | 5 | 5 | 0 | 0 | 0 |
D407 | 4 | 4 | 0 | 0 | 0 |
D413 | 3 | 3 | 0 | 0 | 0 |
PT018 | 2 | 2 | 0 | 0 | 0 |
D106 | 2 | 2 | 0 | 0 | 0 |
D419 | 2 | 2 | 0 | 0 | 0 |
PIE790 | 2 | 2 | 0 | 0 | 0 |
N812 | 2 | 2 | 0 | 0 | 0 |
E703 | 2 | 0 | 2 | 0 | 0 |
D406 | 1 | 1 | 0 | 0 | 0 |
D412 | 1 | 1 | 0 | 0 | 0 |
RUF018 | 1 | 1 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+49879 -93 violations, +0 -0 fixes in 15 projects; 29 projects unchanged)
DisnakeDev/disnake (+125 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ examples/interactions/converters.py:52:29: B008 Do not perform function call `commands.Param` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + examples/interactions/injections.py:61:22: B008 Do not perform function call `commands.inject` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + examples/interactions/injections.py:75:22: B008 Do not perform function call `commands.inject` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + examples/interactions/param.py:68:26: B008 Do not perform function call `commands.Param` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + scripts/ci/versiontool.py:64:5: S101 Use of `assert` detected + scripts/ci/versiontool.py:78:5: S101 Use of `assert` detected + scripts/codemods/base.py:47:13: S101 Use of `assert` detected + test_bot/cogs/injections.py:62:41: B008 Do not perform function call `commands.Param` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable + tests/ext/commands/test_base_core.py:102:9: S101 Use of `assert` detected + tests/ext/commands/test_base_core.py:28:13: S101 Use of `assert` detected ... 115 additional changes omitted for project
apache/airflow (+46555 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ airflow/example_dags/libs/__init__.py:1:1: D104 Missing docstring in public package + airflow/example_dags/libs/helper.py:1:1: D100 Missing docstring in public module + airflow/example_dags/libs/helper.py:21:5: D103 Missing docstring in public function + airflow/example_dags/plugins/__init__.py:1:1: D104 Missing docstring in public package + airflow/example_dags/plugins/decreasing_priority_weight_strategy.py:1:1: D100 Missing docstring in public module + airflow/example_dags/plugins/decreasing_priority_weight_strategy.py:32:9: D102 Missing docstring in public method + airflow/example_dags/plugins/decreasing_priority_weight_strategy.py:36:7: D101 Missing docstring in public class + airflow/example_dags/plugins/event_listener.py:128:5: D200 One-line docstring should fit on one line + airflow/example_dags/plugins/event_listener.py:128:5: D212 [*] Multi-line docstring summary should start at the first line + airflow/example_dags/plugins/event_listener.py:128:5: D401 First line of docstring should be in imperative mood: "This method is called when dag run state changes to SUCCESS." + airflow/example_dags/plugins/event_listener.py:128:5: D404 First word of the docstring should not be "This" + airflow/example_dags/plugins/event_listener.py:144:5: D200 One-line docstring should fit on one line + airflow/example_dags/plugins/event_listener.py:144:5: D212 [*] Multi-line docstring summary should start at the first line + airflow/example_dags/plugins/event_listener.py:144:5: D401 First line of docstring should be in imperative mood: "This method is called when dag run state changes to FAILED." + airflow/example_dags/plugins/event_listener.py:144:5: D404 First word of the docstring should not be "This" + airflow/example_dags/plugins/event_listener.py:162:5: D200 One-line docstring should fit on one line + airflow/example_dags/plugins/event_listener.py:162:5: D212 [*] Multi-line docstring summary should start at the first line + airflow/example_dags/plugins/event_listener.py:162:5: D401 First line of docstring should be in imperative mood: "This method is called when dag run state changes to RUNNING." + airflow/example_dags/plugins/event_listener.py:162:5: D404 First word of the docstring should not be "This" + airflow/example_dags/plugins/event_listener.py:1:1: D100 Missing docstring in public module + airflow/example_dags/plugins/event_listener.py:33:5: D205 1 blank line required between summary line and description + airflow/example_dags/plugins/event_listener.py:33:5: D212 [*] Multi-line docstring summary should start at the first line + airflow/example_dags/plugins/event_listener.py:33:5: D401 First line of docstring should be in imperative mood: "This method is called when task state changes to RUNNING." + airflow/example_dags/plugins/event_listener.py:33:5: D404 First word of the docstring should not be "This" + airflow/example_dags/plugins/event_listener.py:68:5: D205 1 blank line required between summary line and description + airflow/example_dags/plugins/event_listener.py:68:5: D212 [*] Multi-line docstring summary should start at the first line + airflow/example_dags/plugins/event_listener.py:68:5: D401 First line of docstring should be in imperative mood: "This method is called when task state changes to SUCCESS." + airflow/example_dags/plugins/event_listener.py:68:5: D404 First word of the docstring should not be "This" + airflow/example_dags/plugins/event_listener.py:95:5: D205 1 blank line required between summary line and description + airflow/example_dags/plugins/event_listener.py:95:5: D212 [*] Multi-line docstring summary should start at the first line ... 1886 additional changes omitted for rule D212 + airflow/example_dags/plugins/event_listener.py:95:5: D401 First line of docstring should be in imperative mood: "This method is called when task state changes to FAILED." ... 398 additional changes omitted for rule D401 + airflow/example_dags/plugins/event_listener.py:95:5: D404 First word of the docstring should not be "This" ... 81 additional changes omitted for rule D404 + airflow/example_dags/plugins/listener_plugin.py:1:1: D100 Missing docstring in public module + airflow/example_dags/plugins/listener_plugin.py:24:7: D101 Missing docstring in public class + airflow/example_dags/plugins/workday.py:45:7: D101 Missing docstring in public class + airflow/example_dags/plugins/workday.py:46:9: D102 Missing docstring in public method + airflow/example_dags/plugins/workday.py:60:9: D102 Missing docstring in public method + airflow/example_dags/plugins/workday.py:69:9: D102 Missing docstring in public method + airflow/example_dags/plugins/workday.py:99:7: D101 Missing docstring in public class + airflow/example_dags/subdags/__init__.py:1:1: D104 Missing docstring in public package + airflow/providers/arangodb/example_dags/__init__.py:1:1: D104 Missing docstring in public package + airflow/providers/arangodb/example_dags/example_arangodb.py:1:1: D100 Missing docstring in public module + airflow/providers/google/cloud/example_dags/__init__.py:1:1: D104 Missing docstring in public package + airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.py:18:1: D200 One-line docstring should fit on one line + airflow/providers/google/cloud/example_dags/example_looker.py:18:1: D205 1 blank line required between summary line and description + airflow/providers/google/cloud/example_dags/example_presto_to_gcs.py:18:1: D200 One-line docstring should fit on one line ... 46509 additional changes omitted for project
freedomofpress/securedrop (+208 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ securedrop/tests/config_from_2014.py:40:22: S108 Probable insecure usage of temporary file or directory: "/tmp/journalist.pid" + securedrop/tests/config_from_2014.py:41:18: S108 Probable insecure usage of temporary file or directory: "/tmp/source.pid" + securedrop/tests/config_from_2014.py:70:23: S108 Probable insecure usage of temporary file or directory: "/tmp/securedrop" + securedrop/tests/conftest.py:110:37: S108 Probable insecure usage of temporary file or directory: "/tmp/sd-tests/conftest-" + securedrop/tests/conftest.py:310:33: S108 Probable insecure usage of temporary file or directory: "/tmp/securedrop_test_worker.pid" + securedrop/tests/conftest.py:328:28: S108 Probable insecure usage of temporary file or directory: "/tmp/test_rqworker.log" ... 6 additional changes omitted for rule S108 + securedrop/tests/functional/app_navigators/journalist_app_nav.py:106:9: S101 Use of `assert` detected + securedrop/tests/functional/app_navigators/journalist_app_nav.py:122:9: S101 Use of `assert` detected + securedrop/tests/functional/app_navigators/journalist_app_nav.py:148:17: S101 Use of `assert` detected + securedrop/tests/functional/app_navigators/journalist_app_nav.py:172:9: S101 Use of `assert` detected ... 198 additional changes omitted for project
ibis-project/ibis (+7 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ ibis/backends/tests/base.py:27:5: D205 1 blank line required between summary line and description + ibis/backends/tests/base.py:27:5: D212 [*] Multi-line docstring summary should start at the first line + ibis/backends/tests/base.py:337:5: D205 1 blank line required between summary line and description + ibis/backends/tests/base.py:81:9: D205 1 blank line required between summary line and description + ibis/backends/tests/base.py:81:9: D212 [*] Multi-line docstring summary should start at the first line + ibis/tests/util.py:25:5: D205 1 blank line required between summary line and description + ibis/tests/util.py:25:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
mlflow/mlflow (+388 -22 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ dev/proto_to_graphql/autogeneration_utils.py:35:5: T201 `print` found - docs/source/deep-learning/pytorch/quickstart/pytorch_quickstart.ipynb:cell 29:19:25: E226 [*] Missing whitespace around arithmetic operator - docs/source/llms/llm-evaluate/notebooks/question-answering-evaluation.ipynb:cell 29:1:1: W391 [*] Extra newline at end of file - docs/source/llms/llm-evaluate/notebooks/rag-evaluation.ipynb:cell 19:1:1: W391 [*] Extra newline at end of file - docs/source/llms/openai/notebooks/openai-code-helper.ipynb:cell 28:13:21: C419 Unnecessary list comprehension - docs/source/llms/rag/notebooks/question-generation-retrieval-evaluation.ipynb:cell 25:6:15: E226 [*] Missing whitespace around arithmetic operator - docs/source/llms/rag/notebooks/retriever-evaluation-tutorial.ipynb:cell 50:1:1: W391 [*] Extra newline at end of file - docs/source/llms/transformers/tutorials/text-generation/text-generation.ipynb:cell 18:14:34: E226 [*] Missing whitespace around arithmetic operator - docs/source/traditional-ml/hyperparameter-tuning-with-child-runs/notebooks/parent-child-runs.ipynb:cell 15:1:1: W391 [*] Extra newline at end of file - docs/source/traditional-ml/serving-multiple-models-with-pyfunc/notebooks/MME_Tutorial.ipynb:cell 25:1:1: W391 [*] Extra newline at end of file ... 400 additional changes omitted for project
... Truncated remaining completed project reports due to GitHub comment length restrictions
Changes by rule (68 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
S101 | 19886 | 19886 | 0 | 0 | 0 |
D102 | 11929 | 11929 | 0 | 0 | 0 |
D103 | 2741 | 2741 | 0 | 0 | 0 |
D101 | 2242 | 2242 | 0 | 0 | 0 |
D212 | 1893 | 1893 | 0 | 0 | 0 |
D100 | 1694 | 1694 | 0 | 0 | 0 |
D400 | 1514 | 1514 | 0 | 0 | 0 |
D415 | 1509 | 1509 | 0 | 0 | 0 |
S113 | 1250 | 1250 | 0 | 0 | 0 |
D200 | 930 | 930 | 0 | 0 | 0 |
D205 | 853 | 853 | 0 | 0 | 0 |
D104 | 693 | 693 | 0 | 0 | 0 |
NPY002 | 476 | 476 | 0 | 0 | 0 |
D401 | 403 | 403 | 0 | 0 | 0 |
T201 | 325 | 325 | 0 | 0 | 0 |
E241 | 268 | 268 | 0 | 0 | 0 |
D202 | 247 | 247 | 0 | 0 | 0 |
D107 | 122 | 122 | 0 | 0 | 0 |
FLY002 | 122 | 122 | 0 | 0 | 0 |
D404 | 86 | 86 | 0 | 0 | 0 |
S311 | 80 | 80 | 0 | 0 | 0 |
E272 | 79 | 79 | 0 | 0 | 0 |
E501 | 65 | 65 | 0 | 0 | 0 |
D105 | 62 | 62 | 0 | 0 | 0 |
RUF012 | 54 | 54 | 0 | 0 | 0 |
D403 | 47 | 47 | 0 | 0 | 0 |
TRY002 | 37 | 37 | 0 | 0 | 0 |
D209 | 36 | 36 | 0 | 0 | 0 |
B028 | 35 | 35 | 0 | 0 | 0 |
A001 | 33 | 0 | 33 | 0 | 0 |
N806 | 16 | 16 | 0 | 0 | 0 |
B018 | 16 | 0 | 16 | 0 | 0 |
TID253 | 15 | 15 | 0 | 0 | 0 |
TID252 | 15 | 15 | 0 | 0 | 0 |
INP001 | 15 | 15 | 0 | 0 | 0 |
N802 | 15 | 15 | 0 | 0 | 0 |
TID251 | 13 | 13 | 0 | 0 | 0 |
S105 | 13 | 13 | 0 | 0 | 0 |
S108 | 11 | 11 | 0 | 0 | 0 |
UP031 | 11 | 7 | 4 | 0 | 0 |
W391 | 11 | 0 | 11 | 0 | 0 |
A002 | 11 | 0 | 11 | 0 | 0 |
PLW0642 | 10 | 5 | 5 | 0 | 0 |
T203 | 9 | 9 | 0 | 0 | 0 |
RET504 | 9 | 9 | 0 | 0 | 0 |
PLC1901 | 7 | 7 | 0 | 0 | 0 |
RUF003 | 6 | 3 | 3 | 0 | 0 |
B011 | 6 | 6 | 0 | 0 | 0 |
N803 | 6 | 6 | 0 | 0 | 0 |
B008 | 5 | 5 | 0 | 0 | 0 |
PERF203 | 5 | 5 | 0 | 0 | 0 |
D407 | 4 | 4 | 0 | 0 | 0 |
E221 | 4 | 4 | 0 | 0 | 0 |
E226 | 4 | 0 | 4 | 0 | 0 |
D413 | 3 | 3 | 0 | 0 | 0 |
F841 | 3 | 2 | 1 | 0 | 0 |
PT018 | 2 | 2 | 0 | 0 | 0 |
D106 | 2 | 2 | 0 | 0 | 0 |
D419 | 2 | 2 | 0 | 0 | 0 |
PIE790 | 2 | 2 | 0 | 0 | 0 |
N812 | 2 | 2 | 0 | 0 | 0 |
E703 | 2 | 0 | 2 | 0 | 0 |
D406 | 1 | 1 | 0 | 0 | 0 |
D412 | 1 | 1 | 0 | 0 | 0 |
RUF018 | 1 | 1 | 0 | 0 | 0 |
C419 | 1 | 0 | 1 | 0 | 0 |
E266 | 1 | 0 | 1 | 0 | 0 |
E265 | 1 | 0 | 1 | 0 | 0 |
Summary
Set
literal_separator
totrue
for globs.Motivation
By default, the
globset
crate matches files as per the.gitignore
specifications which results infoo/*.py
matchingfoo/hello.py
as well asfoo/bar/hello.py
.This commit changes this by setting the
literal_separator
option totrue
, which ensures that*
and?
never match a path separator.*
in file name incorrectly matches entire file path #6262Test Plan
So far,
cargo test
work, but please advise if you would like me to add new tests specifically for this change (and please point me in the right direction).