Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

The match-dir parameter is not used. #637

Open
EwertonDCSilv opened this issue Mar 16, 2023 · 4 comments
Open

The match-dir parameter is not used. #637

EwertonDCSilv opened this issue Mar 16, 2023 · 4 comments

Comments

@EwertonDCSilv
Copy link

I spent some time reading the documentation, looking for examples, anything that might help with building a regex to bypass certain directories with auto-generated code for migrations. Unfortunately I didn't find anything.

Decides to play around with the lib's code, and noticed that the filter done for match-dir wasn't applied anywhere.

Could you check this problem?

@EwertonDCSilv
Copy link
Author

EwertonDCSilv commented Mar 16, 2023

for name in self._arguments:
if os.path.isdir(name):
for root, dirs, filenames in os.walk(name):
config = self._get_config(os.path.abspath(root))
match, match_dir = _get_matches(config)
ignore_decorators = _get_ignore_decorators(config)
property_decorators = _get_property_decorators(config)
# Skip any dirs that do not match match_dir
dirs[:] = [d for d in dirs if match_dir(d)]
for filename in map(os.path.basename, filenames):
if match(filename):
full_path = os.path.join(root, filename)
yield (
full_path,
list(config.checked_codes),
ignore_decorators,
property_decorators,
config.ignore_self_only_init,
)
else:
config = self._get_config(os.path.abspath(name))
match, _ = _get_matches(config)
ignore_decorators = _get_ignore_decorators(config)
property_decorators = _get_property_decorators(config)
if match(os.path.basename(name)):
yield (
name,
list(config.checked_codes),
ignore_decorators,
property_decorators,
config.ignore_self_only_init,
)

@EwertonDCSilv
Copy link
Author

Focus on line 296

config = self._get_config(os.path.abspath(root))
match, match_dir = _get_matches(config)
ignore_decorators = _get_ignore_decorators(config)
property_decorators = _get_property_decorators(config)
# Skip any dirs that do not match match_dir
dirs[:] = [d for d in dirs if match_dir(d)]
for filename in map(os.path.basename, filenames):
if match(filename):
full_path = os.path.join(root, filename)

@EwertonDCSilv
Copy link
Author

Could you use something like --ignore-glob in pytest?

https://docs.pytest.org/en/7.1.x/example/pythoncollection.html

@EwertonDCSilv
Copy link
Author

Do you have any idea what it might be @Nurdok?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant