Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Fortitude PyPI License Tests Clippy Docs DOI

Fortitude

A Fortran linter, inspired by (and built upon) Ruff. Written in Rust 🦀 and installable with Python 🐍.

Shows a bar chart with benchmark results.

Linting 72 files from the GS2 repo.

  • ⚡ Blazingly fast, up to hundreds of times faster than other open-source Fortran linters.
  • 🔧 Automatically fixes linter warnings.
  • 📈 Over 100 rules, with many more planned.
  • 📃 Multiple output formats, including SARIF and GitHub/GitLab CI.
  • 🤝 Follows community best practices.
  • 💪 Built on a robust tree-sitter parser.

Fortitude is developed by PlasmaFAIR, improving the sustainability of plasma science research software.

PlasmaFAIR logo

Table of Contents

For more detail, please see our documentation.

Installation

Fortitude is available as fortitude-lint on PyPI:

# With uv:
uv tool install fortitude-lint@latest

# With pip:
pip install fortitude-lint

Starting with version 0.7.0, Fortitude can be installed with our standalone installers:

# On macOS and Linux:
curl -LsSf https://github.com/PlasmaFAIR/fortitude/releases/latest/download/fortitude-installer.sh | sh

# On Windows:
powershell -c "irm https://github.com/PlasmaFAIR/fortitude/releases/latest/download/fortitude-installer.psi | iex"

It can also be installed as a pure Rust project:

git clone https://github.com/PlasmaFAIR/fortitude
cd fortitude
cargo install --path crates/fortitude

Fortitude can also be installed via other package managers

Usage

Fortitude can lint your whole project under the working directory using the check command:

fortitude check

You can also call check on individual files, globs, and directories. You can configure what extensions Fortitude searches for in directories with --file-extensions:

fortitude check --file-extensions=f90,fpp

Be default, Fortitude will ignore files and directories in your .gitignore. This can be disabled by setting --no-respect-gitignore. Additional excludes can be set using --extend-exclude:

# Don't check in the `benchmarks/` and `tests/` directories.
fortitude check --extend-exclude=benchmarks,tests

You can select or ignore individual rules or whole groups with --select and --ignore:

# Just check for missing `implicit none`
fortitude check --select=C001
# Also check for missing `implicit none` in interfaces
fortitude check --select=C001,C002
# Ignore all styling rules
fortitude check --ignore=S
# Only check for style rules, but ignore superfluous implicit none
fortitude check --select=S --ignore=S201
# Rules and categories can also be referred to by name
fortitude check --select=style --ignore=superfluous-implicit-none

Use --output-format=concise to get shorter output:

$ fortitude check --output-format=concise
test.f90:2:1: C111 function not contained within (sub)module or program
test.f90:5:1: S061 end statement should read 'end function double'
test.f90:7:1: C111 subroutine not contained within (sub)module or program
test.f90:8:3: C022 real has implicit kind

The explain command can be used to get extra information about any rules:

# Print extra information for all rules
fortitude explain
# Only get information for selected rules
fortitude explain C001 C011
# Print information on all style rules
fortitude explain S
# Rules and categories can also be referred to by name
fortitude explain obsolescent superfluous-implicit-none

Use --summary to get a brief overview:

# Overview of all rules
fortitude explain --summary
# Overview of all style rules
fortitude explain style --summary

To see further commands and optional arguments, try using --help:

fortitude --help
fortitude check --help

Fixes

Fortitude can automatically fix some lint warnings, such as unnecessary implicit none statements, missing double-colons in variable declarations, and more. Just pass the --fix flag to check:

$ fortitude check --fix
fortitude: 1 files scanned.
Number of errors: 2 (2 fixed, 0 remaining)

Run fortitude explain to see which rules have fixes available.

Preview

Some fortitude rules are only available through an opt-in preview mode to give the community some time to evaluate them and provide feedback. To enable preview rules, pass the --preview flag to check,

$ fortitude check --preview

or to enable more permanently, set it in your fpm.toml:

[extra.fortitude.check]
preview = true

or fortitude.toml:

[check]
preview = true

Run fortitude explain to see which rules are in preview mode.

Configuration

Fortitude will look for either a fortitude.toml, .fortitude.toml, fpm.toml, or pyproject.toml file in the current directory, or one of its parents. If using fortitude.toml or .fortitude.toml, settings should be under the command name:

[check]
select = ["C", "E", "S"]
ignore = ["S001", "S082"]
line-length = 132

For fpm.toml files, this has to be additionally nested under the extra.fortitude table:

[extra.fortitude.check]
select = ["C", "E", "S"]
ignore = ["S001", "S082"]
line-length = 132

while pyproject.toml uses tool.fortitude.

You can use --extend-select from the command line to select additional rules on top of those in the configuration file.

# Select correctness, error, style and obsolescent categories
fortitude check --extend-select=OB

A description of configuration options can be viewed using the config command:

# View all options under the 'check' heading
fortitude config check
# Get description of the 'extend-select' option
fortitude config check.extend-select

Editor Integration

Fortitude can be integrated into text editors and IDEs that support the Language Server Protocol (LSP), providing real-time diagnostics and code actions for applying fixes as you work.

Please see the documentation for details on setting this up for your editor.

We also have a VSCode plugin!.

pre-commit

Pre-commit hooks for Fortitude are available at fortitude-pre-commit.

Documentation

See table of rules for a list of all rules.

Contributing

Please feel free to add or suggest new rules and features! See CONTRIBUTING.md for a guide on contributing to the project. This also includes instructions for building the project from source, running tests, and linting/formatting the code. Please consult our code of conduct before contributing.

Projects Using Fortitude

More and more open-source Fortran projects are using Fortitude to help maintain their code, including:

Show Your Support

If you've found Fortitude useful in your project, please consider adding the Fortitude badge to your README.md:

[![Fortitude](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/PlasmaFAIR/fortitude/main/docs/assets/badge/v0.json)](https://github.com/PlasmaFAIR/fortitude)

or README.rst:

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/PlasmaFAIR/fortitude/main/docs/assets/badge/v0.json
    :target: https://github.com/PlasmaFAIR/fortitude
    :alt: Fortitude

or, as HTML:

<a href="https://github.com/PlasmaFAIR/fortitude"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/PlasmaFAIR/fortitude/main/docs/assets/badge/v0.json" alt="Fortitude" style="max-width:100%;"></a>

License

This work is distributed under the MIT License. See LICENSE for more information.

Fortitude is inspired by, and uses parts from ruff, used under the MIT licence. See LICENSE for more information.

Metadata

Release files for fortitude-lint 0.10.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortitude-lint 0.10.0rc1
File Size Uploaded
fortitude_lint-0.10.0rc1.tar.gz 393.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fortitude-lint 0.10.0rc1
File
fortitude_lint-0.10.0rc1-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
fortitude_lint-0.10.0rc1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
fortitude_lint-0.10.0rc1-py3-none-win32.whl Python 3 none Windows x86-32 Details
fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_i686.whl Python 3 none Linux musl 1.2+ x86-32 Details
fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_armv7l.whl Python 3 none Linux musl 1.2+ ARMv7l Details
fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_s390x.whl Python 3 none Linux glibc 2.28+ IBM System/390x Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_ppc64le.whl Python 3 none Linux glibc 2.28+ PowerPC 64-le Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_i686.whl Python 3 none Linux glibc 2.28+ x86-32 Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_armv7l.whl Python 3 none Linux glibc 2.28+ ARMv7l Details
fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
fortitude_lint-0.10.0rc1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
fortitude_lint-0.10.0rc1-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 76.4 MB

Release files / fortitude_lint-0.10.0rc1.tar.gz

Download URL fortitude_lint-0.10.0rc1.tar.gz
Size 393.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dfe5b12f76e3270aa5184b869c4da36652bd49f25921161f9f14f882bac3c2be
BLAKE2b-256 checksum
How to use checksums
685518c6e320903ac9f9d2a3bdd7c97d977a2e82acc5118dfe5365bf46c52287
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-win_arm64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-win_arm64.whl
Size 5.0 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
17b6d5f4f713cc92ce2c609cfc80c14b17b7751e8bcf4baf388a2dbd4fe5639b
BLAKE2b-256 checksum
How to use checksums
85b8dc3c1d765c30ab314c30bf921a151ab52000eaf1d031d040cc323b20c51a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-win_amd64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-win_amd64.whl
Size 5.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
804651e1d76cc238fe7e9b1a41003f9cad0180fbf953cb33587ebc84c07f003f
BLAKE2b-256 checksum
How to use checksums
31759a94b0df4704ffd1209323df518850aaa71e61792e84baac5bf4c6653ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-win32.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-win32.whl
Size 4.8 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
83146f65109bf96acbd64f68d734a6d6646737452b5f5d013b50743beb010d67
BLAKE2b-256 checksum
How to use checksums
30327878ea275dd7409b1645ad89c9fb91d3bf00f142a0952bc55397fb328fbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_x86_64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_x86_64.whl
Size 5.3 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b6af3b7f232e863f3af55cbb5c4366b1a5999accac7f4811d8692395a073ce7c
BLAKE2b-256 checksum
How to use checksums
c7a170fd07b7a1236027749ab96fd1ef9f3d5b97ac5e6f42c73ee5b15606caac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_i686.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_i686.whl
Size 5.3 MB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
cb1cd1ef8640292c6dea85d013df87254edc0029976b209a1a6529f6e8810068
BLAKE2b-256 checksum
How to use checksums
34aab81e2c3f45e9a150203114cc8a4caf1f0e0151eb9d81a1f8cbbaf5b12348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_armv7l.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_armv7l.whl
Size 4.7 MB
Tags Linux musl 1.2+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
86028611576076e741d94b77d9c6de555551e53725ee90e596b3267c23720a62
BLAKE2b-256 checksum
How to use checksums
5798e091b160ab54e5b0762be94a0b77914a0cce3d24c4f7dd6868eddcad37b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_aarch64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-musllinux_1_2_aarch64.whl
Size 4.9 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
06ee989a60f85efc61567457417f9abe1be67916d557673ce1f0595b6dc9d1f5
BLAKE2b-256 checksum
How to use checksums
9fd9813477b18e24c0374577167cc0ce68a8b641af00eab49ced358be059bfb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_x86_64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_x86_64.whl
Size 5.1 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
df47054b3797b05f32fda79b3d98a9ead4f4aac6149b1f5d345b58fcdbb605f0
BLAKE2b-256 checksum
How to use checksums
f9062b51953192db9ccc632af7488457120c4ee2f3fa1b24813934dd0b3e0ac4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_s390x.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_s390x.whl
Size 5.2 MB
Tags Linux glibc 2.28+ IBM System/390x Python 3
SHA-256 checksum
How to use checksums
fc55b7b6860cd25fca14124ca2b5df9bfd83662dcddaef375767a2011b6b460e
BLAKE2b-256 checksum
How to use checksums
113ed1b5cd3bcc3aea9aad0a1787611efdcc721ab77580847e5fb99b0f7e88d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_ppc64le.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_ppc64le.whl
Size 5.8 MB
Tags Linux glibc 2.28+ PowerPC 64-le Python 3
SHA-256 checksum
How to use checksums
209758306edff7906eb41b0a8d115658f94f1fbaecbb1fd36d3dbeb9d58a9898
BLAKE2b-256 checksum
How to use checksums
b817b675fcbc5da885385a6fcd03a57db1eb9c2ed61bc410d202b54a7bc4bc0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_i686.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_i686.whl
Size 5.5 MB
Tags Linux glibc 2.28+ x86-32 Python 3
SHA-256 checksum
How to use checksums
1bfdde0795dc814e4b8590cad7310c669be15618f0f1ebcdcfed1cb263f907ae
BLAKE2b-256 checksum
How to use checksums
919c0774428dc83ad328e4ca318b23d3dad87a3c255c4ac8a64d5acccca70530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_armv7l.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_armv7l.whl
Size 4.7 MB
Tags Linux glibc 2.28+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
982c80510bebb63dde662d3e9df2b5048e4ba3a6d3ec00a7b00f88071e0dc6e1
BLAKE2b-256 checksum
How to use checksums
47d866af9abc99ac04c88c3dd3d05789002218d9054febc187ed2e35d3f06035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_aarch64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-manylinux_2_28_aarch64.whl
Size 4.9 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
3909c052dea30573ded1d8c1550ee0188e44f3ff29426ce89ac639cba1819015
BLAKE2b-256 checksum
How to use checksums
a7d205ee0397ec671e3b13eabc427593aeb51dd1851368969b0304cacee2f484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-macosx_11_0_arm64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-macosx_11_0_arm64.whl
Size 4.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cbf8acf65725b164044aaa07ff5ae62d24f071e95492c64e10278e6a57eb7e69
BLAKE2b-256 checksum
How to use checksums
a3ef73933401c8f500d1237cc2c6b2e0e3f17b7483c92622633e7454fcf2642d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / fortitude_lint-0.10.0rc1-py3-none-macosx_10_12_x86_64.whl

Download URL fortitude_lint-0.10.0rc1-py3-none-macosx_10_12_x86_64.whl
Size 4.9 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9062bcf7a3253e843c5759c2cf400d576b3e4da552fadbfcfbe3c594a703367e
BLAKE2b-256 checksum
How to use checksums
184b0631a5f7b78bbed82554e1c7f8ef97fb611703b1ec7df5048bd76a40ce07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page