Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/fortitude.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
workflow_call:
inputs:
TIMEOUT:
type: number
default: 10
description: "Timeout for the job in minutes"
FAIL:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an on/off flag instead?

type: boolean
default: true
description: "Fail the workflow on fortitude issues"

jobs:
fortitude:
runs-on: ubuntu-24.04
timeout-minutes: ${{ inputs.TIMEOUT }}
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install fortitude
run: pip install fortitude-lint==0.7.5

- name: Get fortitude config
run: |
LOCAL_CONFIG_FILE="fortitude.toml"
GLOBAL_CONFIG_URL="https://raw.githubusercontent.com/scritical/.github/main/fortitude.toml"

if [[ ! -f "$LOCAL_CONFIG_FILE" ]]; then
echo "Downloading global fortitude config..."
wget "$GLOBAL_CONFIG_URL" -O "$LOCAL_CONFIG_FILE" || echo "No global config found, using defaults"
fi

- name: Run fortitude
run: |
CONFIG_FILE="fortitude.toml"
CONFIG_ARG=""
if [[ -f "$CONFIG_FILE" ]]; then
CONFIG_ARG="--config-file $CONFIG_FILE"
fi

# Run fortitude with appropriate fail behavior
if [[ ${{ inputs.FAIL }} == true ]]; then
fortitude $CONFIG_ARG check
else
fortitude $CONFIG_ARG check --exit-zero
fi
14 changes: 14 additions & 0 deletions fortitude.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[check]
line-length = 120
# Core checks
select = ["E", "C", "OB", "MOD", "S", "FORT"]
# Style preferences
ignore = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ignore S102 as well?
S102 [*] need at least 2 spaces before inline comment
This is something that should be handled automatically by a formatter. fprettify added a rule for this recently, but it hasn't made it into a release yet.

On a related note, I think we will need to keep fprettify because Fortitude does not have the same formatting capabilities.

"C003", # implicit-external-procedures: Only valid for Fortran 2018+
"C132", # default-public-accessibility
"S201", # superfluous-implicit-none
"C141", # missing-exit-or-cycle-label
"C121" # use-all
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should enable C121 so we have explicit use statements

]
# Exclude differentiated files by pattern
exclude = ["*_b.f*", "*_d.f*"]