A comprehensive Python code analysis tool that generates code maps and detects issues
Project description
Code Analysis Tool
A comprehensive Python code analysis tool that generates code maps, detects issues, and provides detailed reports.
Features
- Code Mapping: Generates comprehensive maps of classes, functions, and dependencies
- Issue Detection: Identifies code quality problems and violations
- Multiple Report Formats: Outputs reports in YAML format
- Configurable Analysis: Customizable file size limits and analysis parameters
- CLI Interface: Easy-to-use command-line interface
Installation
From PyPI (recommended)
pip install code-analysis-tool
From source
git clone https://github.com/vasilyvz/code-analysis-tool.git
cd code-analysis-tool
pip install -e .
Usage
Basic usage
code-analysis
This will analyze the current directory and generate reports in the code_analysis folder.
Advanced usage
code-analysis --root-dir ./src --output-dir ./reports --max-lines 500 --verbose
Command line options
--root-dir, -r: Root directory to analyze (default: current directory)--output-dir, -o: Output directory for reports (default: code_analysis)--max-lines, -m: Maximum lines per file (default: 400)--verbose, -v: Enable verbose output--version: Show version information
Output Files
The tool generates the following files in the output directory:
code_map.yaml: Complete code map with classes, functions, and dependenciescode_issues.yaml: Detailed report of code quality issuesmethod_index.yaml: Index of methods organized by class
Detected Issues
The tool detects various code quality issues:
- Files without docstrings
- Classes without docstrings
- Methods without docstrings
- Methods with only
passstatements NotImplementedErrorin non-abstract methods- Files exceeding line limit
- Usage of
Anytype annotations - Generic exception handling
- Imports in the middle of files
Development
Setup development environment
git clone https://github.com/vasilyvz/code-analysis-tool.git
cd code-analysis-tool
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"
Running tests
pytest
Code formatting
black .
flake8 .
mypy .
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the linters and fix any issues
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Vasiliy Zdanovskiy
- Email: vasilyvz@gmail.com
- GitHub: @vasilyvz
Changelog
1.0.0
- Initial release
- Basic code analysis functionality
- CLI interface
- YAML report generation
- Issue detection
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_analysis_tool-1.0.0.tar.gz.
File metadata
- Download URL: code_analysis_tool-1.0.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40aa7c1976683c6534b74df951a8298ed15e9d1055f6395c031b20941f743c4a
|
|
| MD5 |
73a846dc299be93cdc6d5ef57b1ef001
|
|
| BLAKE2b-256 |
df7e1e838e9233ebde3e0299d5f3865a30e915bd3e1be9fdda99e7df95d8ba9a
|
File details
Details for the file code_analysis_tool-1.0.0-py3-none-any.whl.
File metadata
- Download URL: code_analysis_tool-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9162220132d56f5505c8690f94306feb9637d3729ba16d659713aa0ffcad615
|
|
| MD5 |
c8c7f5da88b04c6bfb19316662e370ae
|
|
| BLAKE2b-256 |
a3988e119007d5326d43e98ba3d775ae9bb6661841303f261fa53d64e64198bf
|