Skip to content

Integrations

pre-commit

Fortitude can be used as a pre-commit hook via fortitude-pre-commit:

repos:
- repo: https://github.com/PlasmaFAIR/fortitude-pre-commit
  # Fortitude version.
  rev: v0.9.0
  hooks:
    - id: fortitude

To enable fixes, add the --fix argument:

repos:
- repo: https://github.com/PlasmaFAIR/fortitude-pre-commit
  # Fortitude version.
  rev: v0.9.0
  hooks:
    - id: fortitude
      args: ["--fix"]

Other additional arguments are also accepted:

repos:
- repo: https://github.com/PlasmaFAIR/fortitude-pre-commit
  # Fortitude version.
  rev: v0.9.0
  hooks:
    - id: fortitude
      args: ["--fix", "--preview", "--unsafe-fixes"]

When running with --fix, Fortitude's lint hook should be placed before any code formatters in use.

Note that the Fortitude pre-commit hook will run with the option --force-exclude switched on by default. This will prevent Fortitude from checking files that have been explicitly added to your exclude list in your configuration file (fortitude/fpm/pyproject.toml).