Skip to main content

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 dependencies
  • code_issues.yaml: Detailed report of code quality issues
  • method_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 pass statements
  • NotImplementedError in non-abstract methods
  • Files exceeding line limit
  • Usage of Any type 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run the linters and fix any issues
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Vasiliy Zdanovskiy

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

code_analysis_tool-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_analysis_tool-1.0.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

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

Hashes for code_analysis_tool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 40aa7c1976683c6534b74df951a8298ed15e9d1055f6395c031b20941f743c4a
MD5 73a846dc299be93cdc6d5ef57b1ef001
BLAKE2b-256 df7e1e838e9233ebde3e0299d5f3865a30e915bd3e1be9fdda99e7df95d8ba9a

See more details on using hashes here.

File details

Details for the file code_analysis_tool-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_analysis_tool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9162220132d56f5505c8690f94306feb9637d3729ba16d659713aa0ffcad615
MD5 c8c7f5da88b04c6bfb19316662e370ae
BLAKE2b-256 a3988e119007d5326d43e98ba3d775ae9bb6661841303f261fa53d64e64198bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page