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_mapper

This will analyze the current directory and generate reports in the code_analysis folder.

Advanced usage

code_mapper --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.2

  • Changed console command name from code-analysis to code_mapper
  • Fixed .gitignore to properly track source code directory
  • All code quality checks passed

1.0.1

  • Package configuration improvements
  • Enhanced documentation

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.3.tar.gz (18.0 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.3-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file code_analysis_tool-1.0.3.tar.gz.

File metadata

  • Download URL: code_analysis_tool-1.0.3.tar.gz
  • Upload date:
  • Size: 18.0 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.3.tar.gz
Algorithm Hash digest
SHA256 550623e5d6cae1c6313a6bbc2b3159b03d8dcd21afb5b10d2394ba0d4d43731a
MD5 c41eb673ec14473e738b3014ee143e0d
BLAKE2b-256 ddc6acc2f64abe316c285d811a28df6d5e4437425dd404417a7061af65b8faa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for code_analysis_tool-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b30266824e73661874105464c3cfad2d60d9847fb0270436c536b89bf5411635
MD5 37985e06e2df525e561abd6f02d536f3
BLAKE2b-256 4a9ba5a672fd2c96d53ce583d841d7bf028ccf37d0f4310e6ec43e5587b05ac3

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