Conversation
sseraj
left a comment
There was a problem hiding this comment.
One major problem is that Fortitude does not recognize PETSc syntax
src/adjoint/adjointUtils.F90:51:9: E001 Syntax error
|
50 | ! PETSc Matrix Variable
51 | / Mat :: matrix
52 | |
53 | | ! Input Variables
| |__________________________^ E001
I am also seeing some false positives with E001 where the entire file is flagged.
This happens with src/adjoint/adjointExtra.F90 in ADflow, for example.
.github/workflows/fortitude.yaml
Outdated
| type: number | ||
| default: 10 | ||
| description: "Timeout for the job in minutes" | ||
| FAIL: |
There was a problem hiding this comment.
This should be an on/off flag instead?
There was a problem hiding this comment.
I'm going to remove this flag. We can just skip or omit the workflow instead of running with a "no failures" type flag like this.
fortitude.toml
Outdated
| "C132", # default-public-accessibility | ||
| "S201", # superfluous-implicit-none | ||
| "C141", # missing-exit-or-cycle-label | ||
| "C121" # use-all |
There was a problem hiding this comment.
I think we should enable C121 so we have explicit use statements
| # Core checks | ||
| select = ["E", "C", "OB", "MOD", "S", "FORT"] | ||
| # Style preferences | ||
| ignore = [ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Agree with all points. I added S102 to the ignore list and I have no intent to drop fprettify until/unless fortitude formatting improves.
| python-version: "3.11" | ||
|
|
||
| - name: Install fortitude | ||
| run: pip install fortitude-lint==0.7.5 |
There was a problem hiding this comment.
Fortitude 0.8.0 was released recently, and it looks like it might be worth upgrading. There are some new rules and a VS Code extension in the works
| @@ -0,0 +1,44 @@ | |||
| on: | |||
There was a problem hiding this comment.
Can you add this workflow to the README?
This pull request introduces automated linting for Fortran code using Fortitude in the GitHub Actions workflow. It adds a reusable workflow configuration and a project-specific Fortitude configuration file to enforce code quality and style standards.
GitHub Actions workflow integration:
.github/workflows/fortitude.yamlto define a reusable workflow that runs Fortitude checks on Fortran code. The workflow supports configurable timeout and fail behavior, sets up Python, installs Fortitude, downloads a global config if a local one is missing, and runs the lint check with the appropriate exit code.Fortitude configuration:
fortitude.tomlto specify linting rules: sets line length to 120, selects core checks, ignores specific style rules, and excludes files matching certain patterns.Expected time until merged
1-3 days
Type of change
Testing
See this PR for testing logs.
Checklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable