vcode-analysis 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vcode_analysis-0.5.0/vcode_analysis.egg-info → vcode_analysis-0.5.1}/PKG-INFO +1 -1
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/cli.py +28 -6
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/__init__.py +3 -0
- vcode_analysis-0.5.1/core/report_generator.py +586 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/pyproject.toml +1 -1
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/tests/test_c_parser.py +1 -1
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/tests/test_kotlin_parser.py +1 -1
- vcode_analysis-0.5.1/tests/test_report_generator.py +543 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1/vcode_analysis.egg-info}/PKG-INFO +1 -1
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/vcode_analysis.egg-info/SOURCES.txt +2 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/LICENSE +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/MANIFEST.in +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/README.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/__init__.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/architecture.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/code_review.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/context_builder.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/directory.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/documentation.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/analyzers/security.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/analyzer.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/batch_analyzer.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/batch_planner.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/cache_manager.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/config.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/git_handler.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/ignore.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/llm_client.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/core/token_estimator.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/PPT/345/244/247/347/272/262-VCode_Analysis_/346/231/272/350/203/275/344/273/243/347/240/201/345/210/206/346/236/220/345/267/245/345/205/267/345/210/206/344/272/253.md" +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/PPT/347/224/237/346/210/220/346/217/220/347/244/272/350/257/215-VCode_Analysis/345/210/206/344/272/253.md" +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/USER_MANUAL.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/design/batch-cache-optimization.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/design/c-parser-design.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/design/kotlin-parser-design.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/design/vcode-analysis-tool.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/docs/security-sharing-article.md +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/__init__.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c/__init__.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c/ast_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c/models.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c/patterns.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c/regex_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/c_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/java_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/javascript_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin/__init__.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin/ast_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin/models.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin/patterns.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin/regex_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/kotlin_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/python_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/parsers/typescript_parser.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/requirements.txt +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/setup.cfg +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/tests/test_batch_operations.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/tests/test_security_rules.py +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/vcode_analysis.egg-info/dependency_links.txt +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/vcode_analysis.egg-info/entry_points.txt +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/vcode_analysis.egg-info/requires.txt +0 -0
- {vcode_analysis-0.5.0 → vcode_analysis-0.5.1}/vcode_analysis.egg-info/top_level.txt +0 -0
|
@@ -80,6 +80,7 @@ from core import (
|
|
|
80
80
|
Config, Analyzer, GitHandler, BatchGitHandler,
|
|
81
81
|
BatchCodeReviewAnalyzer, BatchConfig, get_cache_manager
|
|
82
82
|
)
|
|
83
|
+
from core.report_generator import ReviewReportGenerator
|
|
83
84
|
from core.ignore import get_default_ignore_patterns
|
|
84
85
|
from analyzers import (
|
|
85
86
|
CodeReviewAnalyzer, DocumentationAnalyzer,
|
|
@@ -263,6 +264,7 @@ class IncrementalReportWriter:
|
|
|
263
264
|
self.file_count = 0
|
|
264
265
|
self.start_time = datetime.now()
|
|
265
266
|
self._header_lines = 10 # 头部占用的行数(用于后续更新统计)
|
|
267
|
+
self._results = [] # 存储所有结果,用于最终生成优化报告
|
|
266
268
|
|
|
267
269
|
def write_header(self) -> None:
|
|
268
270
|
"""写入报告头部"""
|
|
@@ -284,6 +286,7 @@ class IncrementalReportWriter:
|
|
|
284
286
|
def append_result(self, result) -> None:
|
|
285
287
|
"""追加单个分析结果"""
|
|
286
288
|
self.file_count += 1
|
|
289
|
+
self._results.append(result)
|
|
287
290
|
|
|
288
291
|
# 只统计成功的结果
|
|
289
292
|
if getattr(result, 'success', True):
|
|
@@ -297,16 +300,37 @@ class IncrementalReportWriter:
|
|
|
297
300
|
f.write("\n---\n")
|
|
298
301
|
|
|
299
302
|
def finalize(self) -> None:
|
|
300
|
-
"""
|
|
303
|
+
"""完成报告,生成优化 Markdown 和交互式 HTML"""
|
|
304
|
+
try:
|
|
305
|
+
# 使用报告生成器生成优化报告
|
|
306
|
+
generator = ReviewReportGenerator(self.target_path, self.start_time)
|
|
307
|
+
for r in self._results:
|
|
308
|
+
generator.add_result(r)
|
|
309
|
+
|
|
310
|
+
# 生成优化 Markdown(覆盖原文件)
|
|
311
|
+
md_content = generator.generate_markdown()
|
|
312
|
+
self.output_file.write_text(md_content, encoding="utf-8")
|
|
313
|
+
|
|
314
|
+
# 生成交互式 HTML
|
|
315
|
+
html_path = self.output_file.with_suffix(".html")
|
|
316
|
+
html_content = generator.generate_html()
|
|
317
|
+
html_path.write_text(html_content, encoding="utf-8")
|
|
318
|
+
|
|
319
|
+
_log(f"HTML 报告: {html_path}", "OK")
|
|
320
|
+
except Exception as e:
|
|
321
|
+
# 即使生成失败,尝试用旧方式更新统计信息
|
|
322
|
+
print(f"警告: 生成优化报告失败,回退到基础模式: {e}")
|
|
323
|
+
self._finalize_basic()
|
|
324
|
+
|
|
325
|
+
def _finalize_basic(self) -> None:
|
|
326
|
+
"""基础模式:只更新统计信息(回退方案)"""
|
|
301
327
|
try:
|
|
302
328
|
total_time = (datetime.now() - self.start_time).total_seconds()
|
|
303
329
|
avg_score = self.total_score / self.file_count if self.file_count > 0 else 0
|
|
304
330
|
|
|
305
|
-
# 读取现有内容
|
|
306
331
|
content = self.output_file.read_text(encoding="utf-8")
|
|
307
332
|
lines = content.split("\n")
|
|
308
333
|
|
|
309
|
-
# 更新统计行
|
|
310
334
|
updated_lines = []
|
|
311
335
|
for i, line in enumerate(lines):
|
|
312
336
|
if line.startswith("**生成时间**:"):
|
|
@@ -317,8 +341,7 @@ class IncrementalReportWriter:
|
|
|
317
341
|
line = f"**总耗时**: {_format_duration(total_time)}"
|
|
318
342
|
updated_lines.append(line)
|
|
319
343
|
|
|
320
|
-
|
|
321
|
-
insert_idx = 8 # 在 --- 之前
|
|
344
|
+
insert_idx = 8
|
|
322
345
|
stats_lines = [
|
|
323
346
|
f"**平均评分**: {avg_score:.1f}/10",
|
|
324
347
|
f"**问题总数**: {self.total_issues}",
|
|
@@ -328,7 +351,6 @@ class IncrementalReportWriter:
|
|
|
328
351
|
|
|
329
352
|
self.output_file.write_text("\n".join(updated_lines), encoding="utf-8")
|
|
330
353
|
except Exception as e:
|
|
331
|
-
# 即使更新失败,报告内容已经写入,不影响主要功能
|
|
332
354
|
print(f"警告: 更新报告统计信息失败: {e}")
|
|
333
355
|
|
|
334
356
|
|
|
@@ -8,6 +8,7 @@ from .token_estimator import estimate_tokens, estimate_file_tokens, TokenEstimat
|
|
|
8
8
|
from .batch_planner import BatchPlanner, BatchConfig, BatchPlan, FileBatch
|
|
9
9
|
from .batch_analyzer import BatchCodeReviewAnalyzer, BatchReviewResult
|
|
10
10
|
from .cache_manager import CacheManager, get_cache_manager
|
|
11
|
+
from .report_generator import ReviewReportGenerator
|
|
11
12
|
|
|
12
13
|
__all__ = [
|
|
13
14
|
"Config",
|
|
@@ -30,4 +31,6 @@ __all__ = [
|
|
|
30
31
|
"BatchReviewResult",
|
|
31
32
|
"CacheManager",
|
|
32
33
|
"get_cache_manager",
|
|
34
|
+
# 报告生成
|
|
35
|
+
"ReviewReportGenerator",
|
|
33
36
|
]
|