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.6.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.

PyPi install

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

python -m pip install codelimit

Homebrew install

For macOS there is a Homebrew tap available:

brew tap getcodelimit/codelimit
brew install codelimit

The homebrew install takes some time as there are not bottled versions available yet.

Running

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.6.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

codelimit-0.6.2-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file codelimit-0.6.2.tar.gz.

File metadata

  • Download URL: codelimit-0.6.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for codelimit-0.6.2.tar.gz
Algorithm Hash digest
SHA256 26209ca3f09dfa4efc7dafa6fa25a0499aa909c46c41cd35a0ea79487f3c6611
MD5 4f5fca116bceab87e5e00a26572a3acb
BLAKE2b-256 9a98c56316cfac4aed19ef7b05f8455e87b6f1e0273aa3e35d545bbd53dbfc98

See more details on using hashes here.

File details

Details for the file codelimit-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: codelimit-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for codelimit-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bca9343c67f40555c47f9dfcb54b2952c928883b84092e7e51d69923e009257e
MD5 8860dce2f339b2674c34a7968b2fee3b
BLAKE2b-256 961e7264348b4680152c32f8211fb4ab655aba8d294193f5a5907c20e86518d7

See more details on using hashes here.

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