Skip to content

Quickstart

Depending on your development workflow, Code Limit can run as:

Pre-commit hook

Code Limit 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: 0.6.2
    hooks:
    - id: codelimit

Code Limit 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 Code Limit itself.

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

GitHub Action

Code Limit is available as a GitHub Action

When running as a GitHub Action, Code Limit only checks modified files and warns about functions that should be refactored and fails for functions that need to be refactored.

To run Code Limit on every push and before every merge to main, append it to your GH Action workflow:

name: 'main'
on:
  push:
    branches: main
  pull_request:
    branches: main
jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@v2
      - name: 'Run Code Limit'
        uses: getcodelimit/codelimit-action@main

Standalone

Code Limit can also run as a standalone program.

Homebrew install

Code Limit is available on Homebrew:

brew install codelimit

Pipx install

To install the standalone version of Code Limit in an isolated Python environment using pipx run:

pipx install codelimit

PyPi install

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

python -m pip install codelimit

Platform binaries

Binaries for different platforms (macOS, Linux, Windows) are available on the latest release page.