Skip to content
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

Ignore folders in more code paths #129

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Changelog of z3c.dependencychecker
2.14.2 (unreleased)
-------------------

- Nothing changed yet.

- Refactored other `modules.py` classes that needed the same fix from previous release.
[gforcada]

2.14.1 (2023-12-28)
-------------------
Expand Down
28 changes: 12 additions & 16 deletions z3c/dependencychecker/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,12 @@ def create_from_files(cls, top_dir):
if top_dir.endswith(".py"):
return

for path, folders, filenames in os.walk(top_dir):
folders[:] = [d for d in folders if d not in FOLDERS_TO_IGNORE]
for filename in filenames:
if filename.endswith(".txt") or filename.endswith(".rst"):
yield cls(
top_dir,
os.path.join(path, filename),
)
for path, filename in cls.walk_and_filter_folder(top_dir):
if filename.endswith(".txt") or filename.endswith(".rst"):
yield cls(
top_dir,
os.path.join(path, filename),
)

def scan(self):
with open(self.path) as doc_file:
Expand Down Expand Up @@ -400,14 +398,12 @@ def create_from_files(cls, top_dir):
if top_dir.endswith(".py"):
return

for path, folders, filenames in os.walk(top_dir):
folders[:] = [d for d in folders if d not in FOLDERS_TO_IGNORE]
for filename in filenames:
if fnmatch.fnmatch(filename, "*settings.py"):
yield cls(
top_dir,
os.path.join(path, filename),
)
for path, filename in cls.walk_and_filter_folder(top_dir):
if fnmatch.fnmatch(filename, "*settings.py"):
yield cls(
top_dir,
os.path.join(path, filename),
)

def scan(self):
for node in ast.walk(self._get_tree()):
Expand Down