CI / automation

The two things PragyaLint gives CI are a gate — exit code 1 when findings meet --fail-on — and a feed for other tools: JSON or SARIF. Wire either (or both) into your pipeline.

GitHub Actions

A minimal job that gates every PR on high-confidence dead code:

name: quality
on: [pull_request]
jobs:
  dead-code:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install pragyalint
      - run: pragyalint --fail-on high

Code Scanning with SARIF

Emit SARIF and upload it so findings appear as Code Scanning alerts on PRs:

      - run: pragyalint --sarif > pragyalint.sarif
      - uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: pragyalint.sarif

Self-analysis gate

PragyaLint's own CI runs this — it proves the codebase being shipped is clean:

pragyalint --fail-on high --include pragyalint

GitLab CI

dead-code:
  image: python:3.12
  before_script:
    - pip install pragyalint
  script:
    - pragyalint --fail-on medium

With --fail-on medium, any MEDIUM or HIGH finding makes the job fail. Use --json and artifacts:reports if you want structured output in the pipeline.

pre-commit

PragyaLint currently ships no .pre-commit-hooks.yaml, so use a repo: local hook that calls the installed binary:

repos:
  - repo: local
    hooks:
      - id: pragyalint
        name: pragyalint dead-code check
        entry: pragyalint --fail-on high
        language: system
        pass_filenames: false

pass_filenames: false matters — dead-code analysis is whole-project, not per-file.

Tips