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

fix(python_file_finder): load gitignore from where CLI is invoked #380

Merged
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
2 changes: 1 addition & 1 deletion deptry/python_file_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_all_python_files_in(self, directory: Path) -> list[Path]:
ignore_regex = re.compile("|".join(self.exclude + self.extend_exclude))
file_lookup_suffixes = {".py"} if self.ignore_notebooks else {".py", ".ipynb"}

gitignore_spec = self._generate_gitignore_pathspec(directory)
gitignore_spec = self._generate_gitignore_pathspec(Path("."))

for root_str, dirs, files in os.walk(directory, topdown=True):
root = Path(root_str)
Expand Down
1 change: 1 addition & 0 deletions tests/data/project_with_src_directory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/this_file_is_gitignored.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import a_non_existing_module