Skip to content

Git-Scoped Scans

Git integration is optional and defaults to off.

Scan the full repository (default):

reglint analyze --config reglint-rules.yaml

Scan staged files only:

reglint analyze --config reglint-rules.yaml --git-mode staged

Scan files selected by a diff target:

reglint analyze --config reglint-rules.yaml --git-mode diff --git-diff HEAD~1..HEAD

--git-diff implies --git-mode diff if --git-mode is not provided.

Restrict reporting to matches on added lines:

reglint analyze --config reglint-rules.yaml --git-mode diff --git-diff HEAD~1..HEAD --git-added-lines-only

The same settings are available in config under git:

git:
  mode: "diff"
  diff: "HEAD~1..HEAD"
  addedLinesOnly: false
  gitignoreEnabled: true

Ignore-file behavior

  • Ignore files are enabled by default in all modes (off, staged, diff).
  • Default evaluation order is .gitignore, then .ignore, then .reglintignore.
  • Use --no-gitignore to disable only .gitignore.
  • Use --no-ignore-files to disable all ignore-file processing.

Full semantics in Configuration → Ignore files.

Common errors

  • effective --git-mode=diff requires --git-diff — add --git-diff <target> when using --git-mode diff.

Authoritative detail: specs/git-integration.md.