@@ -115,16 +115,22 @@ def _passes_gitignore(self, file_path: str) -> bool:
115115 return True
116116 return not self ._gitignore_parser .is_ignored (Path (file_path ), self .project_path )
117117
118- def _passes_excludes (self , path_lower : str , basename_lower : str ) -> bool :
118+ def _passes_excludes (
119+ self , path_lower : str , basename_lower : str , rel_lower : str | None = None
120+ ) -> bool :
119121 """Check if file passes exclude patterns (True = pass, False = excluded)."""
120122 # Fast substring excludes
121123 for pattern in self ._simple_excludes :
122- if pattern in path_lower :
124+ if pattern in path_lower or ( rel_lower and pattern in rel_lower ) :
123125 return False
124126
125127 # Pre-compiled wildcard excludes
126128 for regex in self ._regex_excludes :
127- if regex .match (path_lower ) or regex .match (basename_lower ):
129+ if (
130+ regex .match (path_lower )
131+ or regex .match (basename_lower )
132+ or (rel_lower and regex .match (rel_lower ))
133+ ):
128134 return False
129135
130136 return True
@@ -146,11 +152,20 @@ def should_process(self, file_path: str) -> bool:
146152 if is_generated_artifact (file_path , self .project_path ):
147153 return False
148154
149- return (
150- self ._passes_gitignore (file_path )
151- and self ._passes_excludes (path_lower , basename_lower )
152- and self ._passes_includes (path_lower )
153- )
155+ if not self ._passes_gitignore (file_path ):
156+ return False
157+
158+ rel_lower = None
159+ if self .project_path :
160+ try :
161+ rel_lower = str (Path (file_path ).relative_to (self .project_path )).lower ()
162+ except ValueError :
163+ pass
164+
165+ if not self ._passes_excludes (path_lower , basename_lower , rel_lower ):
166+ return False
167+
168+ return self ._passes_includes (path_lower )
154169
155170 def _passes_line_count (self , line_count : int ) -> bool :
156171 """Check if function passes line count threshold."""
0 commit comments