1 comments

  • yzzTing 5 hours ago

    I built a command-line tool for analyzing code complexity, similar to Lizard but written in Rust for better performance.

    GitHub: https://github.com/yzzting/LynxEye Crates.io: https://crates.io/crates/lynx_eye

    What it does LynxEye performs function-level static analysis on JavaScript and TypeScript codebases. It extracts metrics that help identify functions that might need refactoring:

    NLOC – Non-commenting lines of code CCN – Cyclomatic complexity (number of independent paths) Token count – Syntactic unit count Parameter count Complexity score – A weighted composite score (0-100) Quick example bash $ lynx_eye src/

    +------+-----+-------+-------+-------+------------------+------+-------------+ | NLOC | CCN | Token | Param | Score | Function | Line | File | +======+====================================================================+ | 45 | 12 | 320 | 4 | 72.3 | processUserData | 89 | handler.ts | | 28 | 8 | 195 | 3 | 54.1 | validateInput | 156 | validator.ts| | 7 | 2 | 30 | 1 | 24.4 | calculateTotal | 1 | utils.js | +------+-----+-------+-------+-------+------------------+------+-------------+

    Why I built this I was using Lizard (Python) at work but found it slow on large TypeScript monorepos. Rust + tree-sitter seemed like a natural fit for parsing code quickly.

    The complexity score formula weights CCN highest (50%), since high cyclomatic complexity is usually the strongest signal that a function needs attention:

    Score = 0.5·CCN_norm + 0.3·NLOC_norm + 0.2·Density_norm

    Features Fast – Parses thousands of files in seconds Multiple output formats – Table (default), JSON, CSV Filtering – --min-score 50, --min-ccn 10, etc. Recursive directory scanning – -r flag File output – --output results.json Installation bash cargo install lynx_eye

    What's next Add support for more languages (Python, Go, Rust) IDE integration (VS Code extension) Trend tracking over git history Would love feedback on the metrics, scoring formula, or any features you'd find useful. PRs welcome!