Skip to content

Settings

Top-level

include

A list of file patterns to include when linting.

Inclusion are based on globs, and should be single-path patterns, like *.f90, to include any file with the .f90 extension.

For more information on the glob syntax, refer to the globset documentation.

Introduced in 0.8.0

Default value: ["*.f90", "*.F90", "*.f95", "*.F95", "*.f03", "*.F03", "*.f08", "*.F08", "*.f18", "*.F18", "*.f23", "*.F23", "*.pf"]

Type: list[str]

Example usage:

[extra.fortitude]
include = ["*.f90", "*.F90"]
include = ["*.f90", "*.F90"]
[tool.fortitude]
include = ["*.f90", "*.F90"]

check

Configures how Fortitude checks your code.

Options specified in the check section take precedence over the deprecated top-level settings.

exclude

A list of file patterns to exclude from formatting and linting.

Exclusions are based on globs, and can be either:

  • Single-path patterns, like build (to exclude any directory named build in the tree), foo.f90 (to exclude any file named foo.f90), or foo_*.f90 (to exclude any file matching foo_*.f90).
  • Relative patterns, like directory/foo.f90 (to exclude that specific file) or directory/*.f90 (to exclude any Fortran files in directory). Note that these paths are relative to the project root (e.g., the directory containing your fpm.toml).

For more information on the glob syntax, refer to the globset documentation.

Note that you'll typically want to use extend-exclude to modify the excluded paths.

Default value: [".git", ".git-rewrite", ".hg", ".svn", "venv", ".venv", "pyenv", ".pyenv", ".eggs", "site-packages", ".vscode", "build", "_build", "dist", "_dist"]

Type: list[str]

Example usage:

[extra.fortitude.check]
exclude = [".venv"]
[check]
exclude = [".venv"]
[tool.fortitude.check]
exclude = [".venv"]

extend-exclude

A list of file patterns to omit from formatting and linting, in addition to those specified by exclude.

Exclusions are based on globs, and can be either:

  • Single-path patterns, like build (to exclude any directory named build in the tree), foo.f90 (to exclude any file named foo.f90), or foo_*.f90 (to exclude any file matching foo_*.f90).
  • Relative patterns, like directory/foo.f90 (to exclude that specific file) or directory/*.f90 (to exclude any Fortran files in directory). Note that these paths are relative to the project root (e.g., the directory containing your fpm.toml).

For more information on the glob syntax, refer to the globset documentation.

Default value: []

Type: list[str]

Example usage:

[extra.fortitude.check]
# In addition to the standard set of exclusions, omit all tests, plus a specific file.
extend-exclude = ["tests", "src/bad.f90"]
[check]
# In addition to the standard set of exclusions, omit all tests, plus a specific file.
extend-exclude = ["tests", "src/bad.f90"]
[tool.fortitude.check]
# In addition to the standard set of exclusions, omit all tests, plus a specific file.
extend-exclude = ["tests", "src/bad.f90"]

extend-fixable

A list of rule codes or prefixes to consider fixable, in addition to those specified by fixable.

Default value: []

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
# On top of the current `fixable` rules, enable fix for implicit-typing (`C001`) and style rules (`S`).
extend-fixable = ["C001", "S"]
[check]
# On top of the current `fixable` rules, enable fix for implicit-typing (`C001`) and style rules (`S`).
extend-fixable = ["C001", "S"]
[tool.fortitude.check]
# On top of the current `fixable` rules, enable fix for implicit-typing (`C001`) and style rules (`S`).
extend-fixable = ["C001", "S"]

extend-select

A list of rule codes or prefixes to enable, in addition to those specified by select.

Default value: []

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
# On top of the current `select` rules, enable missing-intent (`C061`) and portability rules (`PORT`).
extend-select = ["C061", "PORT"]
[check]
# On top of the current `select` rules, enable missing-intent (`C061`) and portability rules (`PORT`).
extend-select = ["C061", "PORT"]
[tool.fortitude.check]
# On top of the current `select` rules, enable missing-intent (`C061`) and portability rules (`PORT`).
extend-select = ["C061", "PORT"]

file-extensions

Deprecated

This option has been deprecated in 0.8.0. The file_extensions option is now deprecated in favour of the top-level include. Please update your configuration to use the include instead.

A list of file extensions to check

Default value: ["f90", "F90", "f95", "F95", "f03", "F03", "f08", "F08", "f18", "F18", "f23", "F23", "pf"]

Type: list[str]

Example usage:

[extra.fortitude.check]
file-extensions = ["f90", "fpp"]
[check]
file-extensions = ["f90", "fpp"]
[tool.fortitude.check]
file-extensions = ["f90", "fpp"]

files

Deprecated

This option has been deprecated in 0.8.0. The files option is now deprecated in favour of the top-level include. Please update your configuration to use the include instead.

A list of file patterns to include when linting.

Inclusion are based on globs, and should be single-path patterns, like *.f90, to include any file with the .f90 extension.

For more information on the glob syntax, refer to the globset documentation.

Default value: ["."]

Type: list[str]

Example usage:

[extra.fortitude.check]
files = ["foo.f90"]
[check]
files = ["foo.f90"]
[tool.fortitude.check]
files = ["foo.f90"]

fix

Enable fix behavior by-default when running fortitude (overridden by the --fix and --no-fix command-line flags). Only includes automatic fixes unless --unsafe-fixes is provided.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
fix = true
[check]
fix = true
[tool.fortitude.check]
fix = true

fix-only

Like fix, but disables reporting on leftover violation. Implies fix.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
fix-only = true
[check]
fix-only = true
[tool.fortitude.check]
fix-only = true

fixable

A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.

Default value: ["ALL"]

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
# Only allow fix behavior for style (`S`) and modernisation (`MOD`) rules.
fixable = ["S", "MOD"]
[check]
# Only allow fix behavior for style (`S`) and modernisation (`MOD`) rules.
fixable = ["S", "MOD"]
[tool.fortitude.check]
# Only allow fix behavior for style (`S`) and modernisation (`MOD`) rules.
fixable = ["S", "MOD"]

force-exclude

Whether to enforce exclude and extend-exclude patterns, even for paths that are passed to Fortitude explicitly. Typically, Fortitude will lint any paths passed in directly, even if they would typically be excluded. Setting force-exclude = true will cause Fortitude to respect these exclusions unequivocally.

This is useful for CI jobs which might explicitly pass all changed files, regardless of whether they're marked as excluded by Fortitude's own settings.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
force-exclude = true
[check]
force-exclude = true
[tool.fortitude.check]
force-exclude = true

ignore

A list of rule codes or prefixes to ignore. Prefixes can specify exact rules (like S201 or superfluous-implicit-none), entire categories (like C or correctness), or anything in between.

When breaking ties between enabled and disabled rules (via select and ignore, respectively), more specific prefixes override less specific prefixes.

Default value: []

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
ignore = ["superfluous-implicit-none"]
[check]
ignore = ["superfluous-implicit-none"]
[tool.fortitude.check]
ignore = ["superfluous-implicit-none"]

ignore-comment-length

By default disable ignore-comment-length behavior when running fortitude.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
ignore-comment-length = true
[check]
ignore-comment-length = true
[tool.fortitude.check]
ignore-comment-length = true

line-length

The line length to use when enforcing long-lines violations (like S001).

The length is determined by the number of characters per line, except for lines containing East Asian characters or emojis. For these lines, the unicode width of each character is added up to determine the length.

Default value: 100

Type: int

Example usage:

[extra.fortitude.check]
# Allow lines to be as long as 120.
line-length = 120
[check]
# Allow lines to be as long as 120.
line-length = 120
[tool.fortitude.check]
# Allow lines to be as long as 120.
line-length = 120

output-format

The style in which violation messages should be formatted: "full" (default) (shows source), "concise", "grouped" (group messages by file), "json" (machine-readable), "junit" (machine-readable XML), "github" (GitHub Actions annotations), "gitlab" (GitLab CI code quality report), "pylint" (Pylint text format) or "azure" (Azure Pipeline logging commands).

Default value: "full"

Type: "full" | "concise" | "grouped" | "json" | "junit" | "github" | "gitlab" | "pylint" | "azure"

Example usage:

[extra.fortitude.check]
# Group violations by containing file.
output-format = "grouped"
[check]
# Group violations by containing file.
output-format = "grouped"
[tool.fortitude.check]
# Group violations by containing file.
output-format = "grouped"

per-file-ignores

A list of mappings from file pattern to rule codes or prefixes to exclude, when considering any matching files. An initial '!' negates the file pattern.

Default value: {}

Type: dict[str, list[RuleSelector]]

Example usage:

[extra.fortitude.check.per-file-ignores]
# Ignore `S201` (superfluous implicit none) in all `test.f90` files, and in `path/to/file.f90`.
"test.f90" = ["S201"]
"path/to/file.f90" = ["S201"]
# Ignore `S` rules everywhere except for the `src/` directory.
"!src/**.f90" = ["S"]
[check.per-file-ignores]
# Ignore `S201` (superfluous implicit none) in all `test.f90` files, and in `path/to/file.f90`.
"test.f90" = ["S201"]
"path/to/file.f90" = ["S201"]
# Ignore `S` rules everywhere except for the `src/` directory.
"!src/**.f90" = ["S"]
[tool.fortitude.check.per-file-ignores]
# Ignore `S201` (superfluous implicit none) in all `test.f90` files, and in `path/to/file.f90`.
"test.f90" = ["S201"]
"path/to/file.f90" = ["S201"]
# Ignore `S` rules everywhere except for the `src/` directory.
"!src/**.f90" = ["S"]

preview

Whether to enable preview mode. When preview mode is enabled, Fortitude will use unstable rules, fixes, and formatting.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
# Enable preview features.
preview = true
[check]
# Enable preview features.
preview = true
[tool.fortitude.check]
# Enable preview features.
preview = true

progress-bar

Progress bar settings. Options are "off" (default), "ascii", and "fancy"

Default value: off

Type: str

Example usage:

[extra.fortitude.check.progress-bar]
# Enable unicode progress bar
progress-bar = "fancy"
[check.progress-bar]
# Enable unicode progress bar
progress-bar = "fancy"
[tool.fortitude.check.progress-bar]
# Enable unicode progress bar
progress-bar = "fancy"

respect-gitignore

Whether to automatically exclude files that are ignored by .ignore, .gitignore, .git/info/exclude, and global gitignore files. Enabled by default.

Default value: true

Type: bool

Example usage:

[extra.fortitude.check]
respect-gitignore = false
[check]
respect-gitignore = false
[tool.fortitude.check]
respect-gitignore = false

select

A list of rule codes or prefixes to enable. Prefixes can specify exact rules (like S201 or superfluous-implicit-none), entire categories (like C or correctness), or anything in between.

By default, a curated set of rules across all categories is enabled; see the documentation for details.

When breaking ties between enabled and disabled rules (via select and ignore, respectively), more specific prefixes override less specific prefixes.

Default value: []

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
# Only check errors and obsolescent features
select = ["E", "OB"]
[check]
# Only check errors and obsolescent features
select = ["E", "OB"]
[tool.fortitude.check]
# Only check errors and obsolescent features
select = ["E", "OB"]

show-fixes

Whether to show an enumeration of all fixed lint violations (overridden by the --show-fixes command-line flag).

Default value: false

Type: bool

Example usage:

[extra.fortitude.check]
# Enumerate all fixed violations.
show-fixes = true
[check]
# Enumerate all fixed violations.
show-fixes = true
[tool.fortitude.check]
# Enumerate all fixed violations.
show-fixes = true

target-std

Minimum Fortran standard to check files against. Options are "f2023", "f2018" (default), "f2008", "f2003", and "f95".

Default value: f2018

Type: "f2023" | "f2018" | "f2008" | "f2003" | "f95"

Example usage:

[extra.fortitude.check]
# Set standard to Fortran 2008
target-std = "f2008"
[check]
# Set standard to Fortran 2008
target-std = "f2008"
[tool.fortitude.check]
# Set standard to Fortran 2008
target-std = "f2008"

unfixable

A list of rule codes or prefixes to consider non-fixable.

Default value: []

Type: list[RuleSelector]

Example usage:

[extra.fortitude.check]
# Disable fix for implicit-external-procedures (`C003`).
unfixable = ["C003"]
[check]
# Disable fix for implicit-external-procedures (`C003`).
unfixable = ["C003"]
[tool.fortitude.check]
# Disable fix for implicit-external-procedures (`C003`).
unfixable = ["C003"]

unsafe-fixes

Enable application of unsafe fixes. If excluded, a hint will be displayed when unsafe fixes are available. If set to false, the hint will be hidden.

Default value: null

Type: bool

Example usage:

[extra.fortitude.check]
unsafe-fixes = true
[check]
unsafe-fixes = true
[tool.fortitude.check]
unsafe-fixes = true

check.complexity

Options for too-complex rule

max-args

The maximum number of arguments allowed for a procedure. Procedures exceeding this threshold will be flagged.

Default value: 5

Type: usize

Example usage:

[extra.fortitude.check.complexity]
max-args = 15
[check.complexity]
max-args = 15
[tool.fortitude.check.complexity]
max-args = 15

max-complexity

The maximum cyclomatic complexity allowed for a procedure. Procedures exceeding this threshold will be flagged.

Default value: 10

Type: usize

Example usage:

[extra.fortitude.check.complexity]
max-complexity = 15
[check.complexity]
max-complexity = 15
[tool.fortitude.check.complexity]
max-complexity = 15

check.exit-unlabelled-loops

Options for the exit-or-cycle-in-unlabelled-loops rule

allow-unnested-loops

Whether to check for exit/cycle in unlabelled loops only if the loop has at least one level of nesting. With this setting off (default), the following will raise a warning, and with it on, it won't:

do i = 1, 100
    if (i == 50) exit
end do

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.exit-unlabelled-loops]
allow-unnested-loops = true
[check.exit-unlabelled-loops]
allow-unnested-loops = true
[tool.fortitude.check.exit-unlabelled-loops]
allow-unnested-loops = true

check.inconsistent-dimensions

Options for inconsistent-dimension set of rules

prefer-attribute

Prefer declaring arrays using the dimension attribute rather than an inline shape, foo(N, M) or vice-versa.

Default behaviour is to keep the current method.

Default value: keep

Type: "keep" | "always" | "never"

Example usage:

[extra.fortitude.check.inconsistent-dimensions]
prefer-attribute = "always"
[check.inconsistent-dimensions]
prefer-attribute = "always"
[tool.fortitude.check.inconsistent-dimensions]
prefer-attribute = "always"

check.incorrect-keyword-case

Options for the incorrect-keyword-case rule

keyword-case

Preferred casing for Fortran keywords, as enforced by the incorrect-keyword-case rule.

Defaults to "lowercase", consistent with modern Fortran conventions.

Default value: lowercase

Type: "lowercase" | "uppercase" | "titlecase"

Example usage:

[extra.fortitude.check.incorrect-keyword-case]
keyword-case = "lowercase"
[check.incorrect-keyword-case]
keyword-case = "lowercase"
[tool.fortitude.check.incorrect-keyword-case]
keyword-case = "lowercase"

check.invalid-tab

Options for invalid-tab rule

indent-width

The number of spaces to replace tabs with.

Default value: 4

Type: int

Example usage:

[extra.fortitude.check.invalid-tab]
indent-width = 2
[check.invalid-tab]
indent-width = 2
[tool.fortitude.check.invalid-tab]
indent-width = 2

check.keyword-whitespace

Options for the keyword-missing-space and keyword-has-whitespace rules

goto-with-space

Whether to enforce the use of go to instead of goto.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.keyword-whitespace]
goto-with-space = true
[check.keyword-whitespace]
goto-with-space = true
[tool.fortitude.check.keyword-whitespace]
goto-with-space = true

inout-with-space

Whether to enforce the use of in out instead of inout.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.keyword-whitespace]
inout-with-space = true
[check.keyword-whitespace]
inout-with-space = true
[tool.fortitude.check.keyword-whitespace]
inout-with-space = true

check.line-too-long

Options for line-too-long rule

ignore-comments

If true, don't take comments into account when checking if a line is too long. This can be useful when dealing with existing codebases with long comments, for instance, or inline comments used for other tools.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.line-too-long]
ignore-comments = true
[check.line-too-long]
ignore-comments = true
[tool.fortitude.check.line-too-long]
ignore-comments = true

check.portability

Options for the portability rules

allow-cray-file-units

Whether to allow file units of 100, 101, 102 in read/write statements for non-portable-io-unit. The Cray compiler pre-connects these to stdin, stdout, and stderr, respectively. However, if you are open-ing these units explicitly, you may wish to switch this to true -- but see also magic-io-unit.

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.portability]
allow-cray-file-units = true
[check.portability]
allow-cray-file-units = true
[tool.fortitude.check.portability]
allow-cray-file-units = true

check.shadowed-variables

Options for the shadowed-variable rule

allow

A list of variable names that are allowed to be shadowed. By default, common loop variables and error flags are allowed to be shadowed.

Default value: ["i", "j", "k", "l", "m", "n", "ii", "jj", "kk", "ll", "mm", "nn", "idx", "index", "err", "ierr", "ioerr", "ios", "info", "stat", "iostat", "istat", "status"]

Type: list[str]

Example usage:

[extra.fortitude.check.shadowed-variables]
allow = ["array", "x"]
[check.shadowed-variables]
allow = ["array", "x"]
[tool.fortitude.check.shadowed-variables]
allow = ["array", "x"]

strict

Strict mode will also check dummy arguments for violations

Default value: false

Type: bool

Example usage:

[extra.fortitude.check.shadowed-variables]
strict = true
[check.shadowed-variables]
strict = true
[tool.fortitude.check.shadowed-variables]
strict = true

check.strings

Options for the string literal rules

quotes

Quote style to prefer for string literals (either "single" or "double").

Default value: "double"

Type: "single" | "double"

Example usage:

[extra.fortitude.check.strings]
quotes = "single"
[check.strings]
quotes = "single"
[tool.fortitude.check.strings]
quotes = "single"

check.use-statements

Options for the use statement rules

allow-bare-use

List of exceptions to the use-all rule. That is, modules allowed to appear in a use statement without an only clause.

While it is recommended to list all used components in an only clause, this can occasionally be impractical for some modules. For example, if the only list would commonly be very long, or would often list all or nearly all of the module's contents.

Note that this option is intended for modules that are safe to use without an only clause across the whole codebase. For one-off instances, consider inline error suppression comments such as ! allow(use-all) instead.

Default value: []

Type: list[str]

Example usage:

[extra.fortitude.check.use-statements]
allow-bare-use = ["utils"]
[check.use-statements]
allow-bare-use = ["utils"]
[tool.fortitude.check.use-statements]
allow-bare-use = ["utils"]