Skip to content

Commit 22cdddb

Browse files
refactor(code2llm): code analysis engine
changes: - file: analyzer.py area: analyzer modified: [_collect_files, ProjectAnalyzer, analyze_project] - file: file_filter.py area: core modified: [FastFileFilter, should_process] - file: gitignore.py area: core modified: [GitIgnoreParser, is_ignored] dependencies: flow: "analyzer→file_filter→gitignore" - analyzer.py -> file_filter.py - file_filter.py -> gitignore.py stats: lines: "+3/-39 (net -36)" files: 3 complexity: "-171% complexity (refactor win)"
1 parent bfbba1f commit 22cdddb

9 files changed

Lines changed: 15 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## [Unreleased]
22

3+
## [0.5.133] - 2026-04-20
4+
5+
### Other
6+
- Update code2llm/core/analyzer.py
7+
- Update code2llm/core/file_filter.py
8+
- Update code2llm/core/gitignore.py
9+
310
## [0.5.132] - 2026-04-20
411

512
### Other

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## AI Cost Tracking
55

6-
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.5.132-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
6+
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.5.133-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
77
![AI Cost](https://img.shields.io/badge/AI%20Cost-$7.50-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-57.3h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
88

99
- 🤖 **LLM usage:** $7.5000 (166 commits)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.132
1+
0.5.133

code2llm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
and entity resolution with multilingual support.
99
"""
1010

11-
__version__ = "0.5.132"
11+
__version__ = "0.5.133"
1212
__author__ = "STTS Project"
1313

1414
# Core analysis components (lightweight, always needed)

code2llm/core/analyzer.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ def __init__(self, config: Optional[Config] = None, project_path: Optional[Path]
4343
def analyze_project(self, project_path: str) -> AnalysisResult:
4444
"""Analyze entire project."""
4545
start_time = time.time()
46-
print(f"DEBUG analyze_project: input project_path={project_path}")
47-
print(f"DEBUG analyze_project: self.project_path before={self.project_path}")
4846
project_path = self._resolve_project_path(project_path)
49-
print(f"DEBUG analyze_project: project_path after resolve={project_path}")
50-
print(f"DEBUG analyze_project: self.project_path after={self.project_path}")
51-
print(f"DEBUG analyze_project: file_filter.project_path={self.file_filter.project_path}")
5247
files = self._collect_files(project_path)
5348

5449
if self.config.verbose:
@@ -67,9 +62,7 @@ def analyze_project(self, project_path: str) -> AnalysisResult:
6762
print(f" ... and {len(files_to_analyze) - 10} more")
6863
print()
6964

70-
print(f"DEBUG analyze_project: files_to_analyze={len(files_to_analyze)}")
7165
fresh_results = self._run_analysis(files_to_analyze)
72-
print(f"DEBUG analyze_project: fresh_results={len(fresh_results)}")
7366
self._store_to_persistent_cache(pcache, files_to_analyze, fresh_results)
7467

7568
merged = self._merge_results(cached_results + fresh_results, str(project_path))
@@ -214,10 +207,6 @@ def _collect_files(self, project_path: Path) -> List[Tuple[str, str]]:
214207
if not self.file_filter.should_process(file_str):
215208
continue
216209

217-
# DEBUG
218-
if 'vendor' in file_str.lower():
219-
print(f"DEBUG _collect_files: COLLECTED vendor file: {file_str}")
220-
221210
# Calculate module name from relative path
222211
rel = os.path.relpath(file_str, project_str)
223212
parts = rel.replace('\\', '/').split('/')
@@ -231,10 +220,6 @@ def _collect_files(self, project_path: Path) -> List[Tuple[str, str]]:
231220

232221
files.append((file_str, module_name))
233222

234-
# DEBUG
235-
vendor_count = len([f for f, m in files if 'vendor' in f.lower()])
236-
print(f"DEBUG _collect_files: total={len(files)}, vendor={vendor_count}")
237-
238223
return files
239224

240225
def _analyze_parallel(self, files: List[Tuple[str, str]]) -> List[Dict]:

code2llm/core/file_filter.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,10 @@ def should_process(self, file_path: str) -> bool:
9898
path_lower = file_path.lower()
9999
basename_lower = Path(file_path).name.lower()
100100

101-
passes_gitignore = self._passes_gitignore(file_path)
102-
passes_excludes = self._passes_excludes(path_lower, basename_lower)
103-
passes_includes = self._passes_includes(path_lower)
104-
105-
# DEBUG
106-
if 'vendor' in file_path.lower():
107-
print(f"DEBUG should_process: {file_path}")
108-
print(f" passes_gitignore={passes_gitignore}, passes_excludes={passes_excludes}, passes_includes={passes_includes}")
109-
print(f" _gitignore_parser={self._gitignore_parser}, project_path={self.project_path}")
110-
111101
return (
112-
passes_gitignore and
113-
passes_excludes and
114-
passes_includes
102+
self._passes_gitignore(file_path) and
103+
self._passes_excludes(path_lower, basename_lower) and
104+
self._passes_includes(path_lower)
115105
)
116106

117107
def _passes_line_count(self, line_count: int) -> bool:

code2llm/core/gitignore.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,11 @@ def is_ignored(self, file_path: Path, project_root: Path) -> bool:
110110
except ValueError:
111111
return False
112112

113-
# DEBUG
114-
if 'vendor' in path_str:
115-
print(f"DEBUG is_ignored: path_str={path_str}, entries={len(self._entries)}")
116-
117113
ignored = False
118114
for entry in self._entries:
119115
if entry.regex.search(path_str):
120-
# DEBUG
121-
if 'vendor' in path_str:
122-
print(f"DEBUG is_ignored: MATCHED pattern={entry.regex.pattern}, is_negated={entry.is_negated}")
123116
ignored = not entry.is_negated
124117

125-
# DEBUG
126-
if 'vendor' in path_str:
127-
print(f"DEBUG is_ignored: result={ignored}")
128-
129118
return ignored
130119

131120

code2llm/nlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
with multilingual support and fuzzy matching.
55
"""
66

7-
__version__ = "0.5.132"
7+
__version__ = "0.5.133"
88

99
from .pipeline import NLPPipeline
1010
from .normalization import QueryNormalizer

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "code2llm"
7-
version = "0.5.132"
7+
version = "0.5.133"
88
description = "High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries"
99
readme = "README.md"
1010
requires-python = ">=3.8"

0 commit comments

Comments
 (0)