134 lines
3.3 KiB
Markdown
134 lines
3.3 KiB
Markdown
# Claude Scripts - Code Quality Analysis Toolkit
|
|
|
|
A comprehensive Python code quality analysis toolkit for detecting duplicates, complexity metrics, and modernization opportunities.
|
|
|
|
## Features
|
|
|
|
- **Duplicate Detection**: Find similar code patterns across your codebase using advanced similarity algorithms
|
|
- **Complexity Analysis**: Calculate cyclomatic complexity, maintainability index, and other code metrics
|
|
- **Modernization Analysis**: Identify opportunities to modernize Python code patterns and syntax
|
|
- **Code Smells Detection**: Detect common code smells and anti-patterns
|
|
- **Multiple Output Formats**: Support for JSON, console, and CSV output formats
|
|
- **Comprehensive Reports**: Full analysis reports with quality scores and recommendations
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install claude-scripts
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Command Line Interface
|
|
|
|
The package provides a `claude-quality` command with several subcommands:
|
|
|
|
#### Duplicate Detection
|
|
```bash
|
|
claude-quality duplicates src/ --threshold 0.8 --format console
|
|
```
|
|
|
|
#### Complexity Analysis
|
|
```bash
|
|
claude-quality complexity src/ --threshold 10 --format json
|
|
```
|
|
|
|
#### Modernization Analysis
|
|
```bash
|
|
claude-quality modernization src/ --include-type-hints --format console
|
|
```
|
|
|
|
#### Full Analysis
|
|
```bash
|
|
claude-quality full-analysis src/ --format json --output report.json
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Create a configuration file to customize analysis parameters:
|
|
|
|
```bash
|
|
claude-quality create-exceptions-template --output-path .quality-exceptions.yaml
|
|
```
|
|
|
|
Use the configuration file:
|
|
|
|
```bash
|
|
claude-quality --config config.yaml --exceptions-file .quality-exceptions.yaml duplicates src/
|
|
```
|
|
|
|
## Command Reference
|
|
|
|
### Global Options
|
|
|
|
- `--config, -c`: Path to configuration file
|
|
- `--exceptions-file, -e`: Path to exceptions configuration file
|
|
- `--verbose, -v`: Enable verbose output
|
|
|
|
### Duplicates Command
|
|
|
|
```bash
|
|
claude-quality duplicates [OPTIONS] PATHS...
|
|
```
|
|
|
|
Options:
|
|
- `--threshold, -t`: Similarity threshold (0.0-1.0, default: 0.8)
|
|
- `--min-lines`: Minimum lines for duplicate detection (default: 5)
|
|
- `--min-tokens`: Minimum tokens for duplicate detection (default: 50)
|
|
- `--output, -o`: Output file for results
|
|
- `--format`: Output format (json/console/csv, default: json)
|
|
|
|
### Complexity Command
|
|
|
|
```bash
|
|
claude-quality complexity [OPTIONS] PATHS...
|
|
```
|
|
|
|
Options:
|
|
- `--threshold`: Complexity threshold (default: 10)
|
|
- `--output, -o`: Output file for results
|
|
- `--format`: Output format (json/console, default: json)
|
|
|
|
### Modernization Command
|
|
|
|
```bash
|
|
claude-quality modernization [OPTIONS] PATHS...
|
|
```
|
|
|
|
Options:
|
|
- `--include-type-hints`: Include missing type hint analysis
|
|
- `--pydantic-only`: Only analyze Pydantic patterns
|
|
- `--output, -o`: Output file for results
|
|
- `--format`: Output format (json/console, default: json)
|
|
|
|
### Full Analysis Command
|
|
|
|
```bash
|
|
claude-quality full-analysis [OPTIONS] PATHS...
|
|
```
|
|
|
|
Options:
|
|
- `--output, -o`: Output file for results
|
|
- `--format`: Output format (json/console, default: json)
|
|
|
|
## Requirements
|
|
|
|
- Python ≥ 3.12
|
|
- Dependencies: click, pyyaml, pydantic, radon
|
|
|
|
## Development
|
|
|
|
Install development dependencies:
|
|
|
|
```bash
|
|
pip install claude-scripts[dev]
|
|
```
|
|
|
|
## License
|
|
|
|
MIT License - see LICENSE file for details.
|
|
|
|
## Contributing
|
|
|
|
This is a personal project. Please report issues or suggestions through the repository's issue tracker.
|