Skip to content

fix: correct analyzer statistics - #38

Open
mikemikimike wants to merge 1 commit into
ferrix-lab:mainfrom
mikemikimike:issue-25-analyzer-fixes
Open

fix: correct analyzer statistics#38
mikemikimike wants to merge 1 commit into
ferrix-lab:mainfrom
mikemikimike:issue-25-analyzer-fixes

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary / Problem

Closes #25.

The analyzer miscounted C-style inline block comments, omitted async def functions from Python statistics, and stored None for relative imports such as from . import utils.

Changes

  • Close a block-comment state on the same line when /* ... */ is inline, so following executable lines are not counted as comments.
  • Count ast.AsyncFunctionDef alongside regular Python functions.
  • Represent relative imports with their dot level instead of appending None when ImportFrom.module is absent.
  • Add focused regression tests for all three behaviors.

Tests

  • .venv\\Scripts\\python.exe -m pytest --basetemp=.pytest-tmp-full tests/ -q — 3 passed.
  • .venv\\Scripts\\python.exe -m py_compile setup.py insight\\__init__.py insight\\analyzer.py insight\\cli.py insight\\detector.py insight\\reporter.py insight\\utils.py — passed.
  • .venv\\Scripts\\python.exe -c "import insight" — passed.
  • Ruff check and format check for tests\\test_analyzer.py — passed.
  • Targeted Ruff check for insight\\analyzer.py with the pre-existing I001, BLE001, and LOG015 findings excluded — passed.

Compatibility / Known limitations

The existing statistics shape is preserved; only the affected values are corrected. The upstream baseline currently reports 13 existing Ruff findings, including historical findings in insight/analyzer.py; no unrelated cleanup is included here. Tests emit the existing deprecation warning from the google.generativeai dependency but do not call the external API.

Issue link

#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(analyzer): C-style inline block comments cause infinite comment counting, and python async functions are missed

1 participant