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.
| type: number | ||
| default: 10 | ||
| description: "Timeout for the job in minutes" | ||
| FAIL: |
| "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.
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