Skip to main content

No project description provided

Project description

CodeLimit

Your Refactoring Alarm

Logo

CI codecov Checked with mypy Code style: black Linting: Ruff Checked with CodeLimit

Quickstart

Pre-commit hook

CodeLimit can be installed as a pre-commit hook so it alarms you during development when it's time to refactor:

-   repo: https://github.com/getcodelimit/codelimit
    rev: v0.3.0
    hooks:
    - id: codelimit

CodeLimit is intended to be used alongside formatting, linters and other hooks that improve the consistency and quality of your code (such as Black, Ruff and MyPy.) As an example pre-commit configuration see the pre-commit-config.yaml from CodeLimit itself.

When running as a hook, CodeLimit warns about functions that should be refactored and fails for functions that need to be refactord.

To show your project uses CodeLimit place this badge in the README markdown:

![Checked with CodeLimit](https://img.shields.io/badge/CodeLimit-checked-green.svg)](https://github.com/getcodelimit/codelimit)

Standalone

CodeLimit can also run as a standalone program. To install the standalone version of CodeLimit for your default Python installation run:

python -m pip install codelimit

Run CodeLimit without arguments to see the usage page:

$ codelimit

 Usage: codelimit [OPTIONS] COMMAND [ARGS]...

 CodeLimit: Your refactoring alarm

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ check                 Check file(s)                                          │
│ scan                  Scan a codebase                                        │
╰──────────────────────────────────────────────────────────────────────────────╯

Scanning a codebase

To scan a complete codebase and launch the TUI, run:

codelimit scan path/to/codebase

Screenshot

Checking files

To check a single file or list of files for functions that need refactoring, run:

codelimit check a.py b.py c.py

Development

After installing dependencies with poetry install, CodeLimit can be run from the repository root like this:

poetry run codelimit

For example, to check a codebase at ~/projects/fastapi run:

poetry run codelimit ~/projects/fastapi

Using the Textal debug console

Open a terminal and start the Textual debug console:

poetry run textual console

Next, open another terminal and start Code Limit in development mode:

poetry run textual run --dev main.py

Building the binary distribution

Generate a self-contained binary:

poetry run poe bundle

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

codelimit-0.4.0.tar.gz (18.5 kB view hashes)

Uploaded Source

Built Distribution

codelimit-0.4.0-py3-none-any.whl (31.5 kB view hashes)

Uploaded Python 3

Supported by

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