@@ -40,7 +40,6 @@ def scan_codebase(path: Path, cached_report: Union[Report, None] = None) -> Code
4040 print_header (cached_report , path )
4141 scan_totals = ScanTotals ()
4242 with Live (refresh_per_second = 2 ) as live :
43-
4443 def add_file_entry (entry : SourceFileEntry ):
4544 scan_totals .add (entry )
4645 table = ScanResultTable (scan_totals )
@@ -82,12 +81,13 @@ def print_refactor_candidates(scan_totals: ScanTotals):
8281
8382
8483def _scan_folder (
85- codebase : Codebase ,
86- folder : Path ,
87- cached_report : Union [Report , None ] = None ,
88- add_file_entry : Union [Callable [[SourceFileEntry ], None ], None ] = None ,
84+ codebase : Codebase ,
85+ folder : Path ,
86+ cached_report : Union [Report , None ] = None ,
87+ add_file_entry : Union [Callable [[SourceFileEntry ], None ], None ] = None ,
8988):
90- excludes = Configuration .excludes .copy ()
89+ excludes = DEFAULT_EXCLUDES .copy ()
90+ excludes .extend (Configuration .excludes )
9191 gitignore_excludes = _read_gitignore (folder )
9292 if gitignore_excludes :
9393 excludes .extend (gitignore_excludes )
@@ -115,11 +115,11 @@ def _scan_folder(
115115
116116
117117def _scan_file (
118- codebase : Codebase ,
119- lexer : Lexer ,
120- root : Path ,
121- path : str ,
122- cached_report : Union [Report , None ] = None ,
118+ codebase : Codebase ,
119+ lexer : Lexer ,
120+ root : Path ,
121+ path : str ,
122+ cached_report : Union [Report , None ] = None ,
123123) -> SourceFileEntry :
124124 checksum = calculate_checksum (path )
125125 rel_path = relpath (path , root )
@@ -190,3 +190,33 @@ def _read_gitignore(path: Path) -> list[str] | None:
190190
191191def is_excluded (path : Path , spec : PathSpec ):
192192 return spec .match_file (path )
193+
194+
195+ DEFAULT_EXCLUDES = [
196+ ".bzr" ,
197+ ".direnv" ,
198+ ".eggs" ,
199+ ".git" ,
200+ ".git-rewrite" ,
201+ ".hg" ,
202+ ".ipynb_checkpoints" ,
203+ ".mypy_cache" ,
204+ ".nox" ,
205+ ".pants.d" ,
206+ ".pytest_cache" ,
207+ ".pytype" ,
208+ ".ruff_cache" ,
209+ ".svn" ,
210+ ".tox" ,
211+ ".venv" ,
212+ ".vscode" ,
213+ "__pypackages__" ,
214+ "_build" ,
215+ "buck-out" ,
216+ "build" ,
217+ "dist" ,
218+ "node_modules" ,
219+ "venv" ,
220+ "test" ,
221+ "tests" ,
222+ ]
0 commit comments