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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: codelimit-0.6.0.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.0.tar.gz
Algorithm Hash digest
SHA256 2791dded3c894a44525bcb9d354088626d1627272137b8273513bfb704efbfea
MD5 99cc309968b0af5b3b42bd37b88d310f
BLAKE2b-256 71db872656169f3a75e923faf89c4ef57ccf7691722422e6d708f6ced6edbde2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codelimit-0.6.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44099bdf17fbeb25430df7ab6a4126104c590d041a556c970f81a17db3fada7f
MD5 f8c4472b431c6082df98ef6609dbdeb0
BLAKE2b-256 3195b3c1f4c93d173c65d9e6eb3e28e933f82745ea2fec78a4b7b7b9d2cd83de

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