Building with Cursor, Claude, or ChatGPT? jscan performs structural analysis to keep your codebase maintainable.
Sister project: pyscn - Python Code Quality Analyzer
- Complexity Analysis: Calculate McCabe cyclomatic complexity for functions
- Dead Code Detection: Find unreachable code blocks
- JavaScript Support: Full support for ES6+ JavaScript syntax
- TypeScript Support: Full parser support for TypeScript
- Fast Performance: Built in Go with tree-sitter for efficient parsing
git clone https://github.com/ludo-technologies/jscan.git
cd jscan
go build -o jscan ./cmd/jscango install github.com/ludo-technologies/jscan/cmd/jscan@latest# Analyze a single file
jscan analyze src/index.js
# Analyze a directory
jscan analyze src/
# Run specific analyses
jscan analyze --select complexity src/
jscan analyze --select deadcode src/
jscan analyze --select complexity,deadcode src/Analyzing 1 files...
src/index.js:
Complexity Analysis:
calculateTotal: complexity=5, risk=medium
processData: complexity=2, risk=low
Dead Code Analysis:
calculateTotal: 1 dead code blocks found
Line 42: Code after return statement is unreachable
Analysis complete!
Files analyzed: 1
jscan follows Clean Architecture principles:
jscan/
├── cmd/jscan/ # CLI entry point
├── domain/ # Domain models
├── internal/
│ ├── parser/ # tree-sitter JavaScript/TypeScript parser
│ ├── analyzer/ # CFG, complexity, dead code analysis
│ ├── config/ # Configuration management
│ └── reporter/ # Output formatting
└── testdata/ # Test fixtures
Current Version: v0.1.0-alpha
jscan is in early development. Currently implemented:
- ✅ Complexity Analysis
- ✅ Dead Code Detection
- ✅ Basic CLI
Planned features:
- Clone Detection (APTED + LSH-based structural similarity)
- Module Analysis & Coupling Metrics
- TypeScript-specific analysis features
- Additional output formats (JSON, HTML, CSV)
- npm package distribution
jscan uses JSON-based configuration files, following JavaScript ecosystem conventions.
Create a jscan.config.json or .jscanrc.json file in your project root:
{
"complexity": {
"lowThreshold": 10,
"mediumThreshold": 20,
"enabled": true
},
"deadCode": {
"enabled": true,
"minSeverity": "warning"
},
"output": {
"format": "text",
"showDetails": true
}
}See jscan.config.example.json for all available options.
# Run unit tests
go test ./...
# Test on sample files
./jscan analyze testdata/javascript/simple/
# Run with Makefile
make test
make runMIT License - see LICENSE file for details
Created by @daisukeyoda
Sister project: pyscn - Python Code Quality Analyzer