Skip to content

Integrations

Michael L. McKnight edited this page Dec 5, 2026 · 2 revisions

Integrations

Canonical source: docs/integrations.md. The examples pin the v1.4.0 release tag of ZodiacDog/Code-Cleaner. Use a newer tag when one is released. Current main is ahead of that tag (TypeScript, suppressions, project config, Java taint, and one-level Python inter-procedural taint); those ship in the next release. See the Changelog.

Plain CI step (any CI system)

python -m pip install "code-cleaner[all] @ git+https://github.com/ZodiacDog/Code-Cleaner@v1.4.0"
code-cleaner analyze src/ --fail-on high --min-score 70 --format sarif -o code-cleaner.sarif

Exit code 0 = passed, 1 = gate failed, 2 = usage error. --fail-on accepts critical|high|medium|low|info|none; analyze defaults to none (report only).

GitHub Action

The repository root is a composite action (action.yml).

Input Default Meaning
paths . Files or folders, space-separated
format sarif sarif, json or text
output code-cleaner.sarif Report file
fail-on high Severity gate (none = never fail on findings)
min-score empty Quality-score gate
extras all Optional dependencies: all, treesitter, js, java, or empty
python-version 3.12 Python used to run Code Cleaner
args empty Extra analyze arguments, split on spaces

Outputs: report (path) and exit-code.

name: Code Cleaner
on: [push, pull_request]
permissions:
  contents: read
  security-events: write          # needed to upload SARIF
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: ZodiacDog/Code-Cleaner@v1.4.0
        with:
          paths: src
          fail-on: high
          args: --exclude tests/*
      - uses: github/codeql-action/upload-sarif@v3
        if: always()              # upload even when the gate failed
        with:
          sarif_file: code-cleaner.sarif
          category: code-cleaner

.github/workflows/code-cleaner-example.yml is a complete version of this that scans this repository itself. Findings then appear under Security → Code scanning, with taint traces shown as code flows. Code scanning is free for public repositories; private repositories need GitHub Advanced Security.

This project's own test CI is .github/workflows/ci.yml (Python 3.10–3.13, bare and [all] installs).

pre-commit

.pre-commit-hooks.yaml defines two hooks:

Hook id Fails on
code-cleaner HIGH or worse
code-cleaner-strict MEDIUM or worse

In your project's .pre-commit-config.yaml:

repos:
  - repo: https://github.com/ZodiacDog/Code-Cleaner
    rev: v1.4.0
    hooks:
      - id: code-cleaner
        additional_dependencies: ["code-cleaner[all] @ git+https://github.com/ZodiacDog/Code-Cleaner@v1.4.0"]   # optional
        args: ["--fail-on", "high", "--no-ai-checks"]                                           # optional

The hooks run on staged files of the supported types. Without additional_dependencies the core (standard library) analyzers are used.

SARIF and JSON

--format sarif writes SARIF 2.1.0 (validated against the OASIS schema). It opens in the VS Code SARIF Viewer and works with GitLab, Azure DevOps and other SARIF consumers. Paths are relative to the current directory (use --absolute-paths to keep absolute ones).

--format json is convenient for scripts; the shape is described in the README.

Clone this wiki locally