A collection of python tools to inspect code quality.
Project description
inspectr
A collection of python tools to inspect code quality.
Installation
python -m venv .venv/
source .venv/bin/activate
pip install inspectr
Usage
Generally, the syntax goes:
inspectr <subtool> [options] [files...]
where <subtool> is one of the following:
authenticity: looks for TODO comments, empty try/except blocks, and stub functionsbare_ratio: checks for the ratio of bare excepts to meaningful exception usagecompare_funcs: compares function/method names across two directory versionscomplexity: analyzes algorithmic complexity of Python codecount_exceptions: counts how many of each type of exception there are (including bare except)duplicates: looks for occurrences of duplicate or similar code (>80% similarity, default: 10+ lines, 3+ occurrences)size_counts: various linecount-related code complexity checkswith_open: checks foropenin the absense ofwithand manual calls toclose()
Command-Line Options
All tools accept command-line options in the format --option-name value.
Options are passed as keyword arguments to the tool's main function. For example:
inspectr duplicates --block-size 15 --min-occur 2 file1.py file2.py
Recognized options include:
duplicates:--block-size N: number of consecutive lines in a block (default: 10)--min-occur N: minimum number of occurrences to report (default: 3
Note: any unrecognized options will be silently ignored.
Usage for compare_funcs
The compare_funcs tool compares functions across two directory versions:
inspectr compare_funcs files_list.txt dir1 dir2
where files_list.txt contains relative paths to compare, one per line.
Local Testing
First install in development mode with test dependencies, then run the tests:
git clone https://github.com/ajcm474/inspectr.git
cd inspectr
pip install -e ".[test]"
pytest tests/
Please note: this project is in the early alpha stage, so don't expect the above subtool names to be stable between versions. I might even merge/split them at some point.
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 inspectr-0.1.1.tar.gz.
File metadata
- Download URL: inspectr-0.1.1.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d122318764105c5db214ed7af49b3041861f8b63e2955adf0034ef9ac32cb8c8
|
|
| MD5 |
909afa91628dec7d309268be1513469d
|
|
| BLAKE2b-256 |
9d93f82e62067f44dcc999d9c83c5893063bf7cd58d6ccc7741a9ec6a030523e
|
File details
Details for the file inspectr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: inspectr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b14799a4d15965fbe80318e994aecdf8520af366c320a89fd17a010c056c4fbe
|
|
| MD5 |
ddc6342a595cd542b626b3e93f4cf878
|
|
| BLAKE2b-256 |
235ad5de9213eb98abe6a4d12ecd335c3e30f3fc0d0549196e30cc07ec241227
|