Skip to content

Commit 2560ea7

Browse files
authored
Merge pull request #129 from reinout/more-ignore-files
Ignore folders in more code paths
2 parents f1c2a2f + cb9c220 commit 2560ea7

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

CHANGES.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Changelog of z3c.dependencychecker
44
2.14.2 (unreleased)
55
-------------------
66

7-
- Nothing changed yet.
8-
7+
- Refactored other `modules.py` classes that needed the same fix from previous release.
8+
[gforcada]
99

1010
2.14.1 (2023-12-28)
1111
-------------------

z3c/dependencychecker/modules.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,12 @@ def create_from_files(cls, top_dir):
349349
if top_dir.endswith(".py"):
350350
return
351351

352-
for path, folders, filenames in os.walk(top_dir):
353-
folders[:] = [d for d in folders if d not in FOLDERS_TO_IGNORE]
354-
for filename in filenames:
355-
if filename.endswith(".txt") or filename.endswith(".rst"):
356-
yield cls(
357-
top_dir,
358-
os.path.join(path, filename),
359-
)
352+
for path, filename in cls.walk_and_filter_folder(top_dir):
353+
if filename.endswith(".txt") or filename.endswith(".rst"):
354+
yield cls(
355+
top_dir,
356+
os.path.join(path, filename),
357+
)
360358

361359
def scan(self):
362360
with open(self.path) as doc_file:
@@ -400,14 +398,12 @@ def create_from_files(cls, top_dir):
400398
if top_dir.endswith(".py"):
401399
return
402400

403-
for path, folders, filenames in os.walk(top_dir):
404-
folders[:] = [d for d in folders if d not in FOLDERS_TO_IGNORE]
405-
for filename in filenames:
406-
if fnmatch.fnmatch(filename, "*settings.py"):
407-
yield cls(
408-
top_dir,
409-
os.path.join(path, filename),
410-
)
401+
for path, filename in cls.walk_and_filter_folder(top_dir):
402+
if fnmatch.fnmatch(filename, "*settings.py"):
403+
yield cls(
404+
top_dir,
405+
os.path.join(path, filename),
406+
)
411407

412408
def scan(self):
413409
for node in ast.walk(self._get_tree()):

0 commit comments

Comments
 (0)