Skip to content

Commit

Permalink
Merge pull request #129 from reinout/more-ignore-files
Browse files Browse the repository at this point in the history
Ignore folders in more code paths
  • Loading branch information
gforcada authored Dec 28, 2023
2 parents f1c2a2f + cb9c220 commit 2560ea7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
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

0 comments on commit 2560ea7

Please sign in to comment.