/codelimit

Primary LanguagePythonISC LicenseISC

CodeLimit

Your Refactoring Alarm

Logo

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

Quickstart

Installation

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

Screenshot

To install the standalone version of CodeLimit for your default Python installation run:

python -m pip install codelimit

Development

After installing depencies 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