Add Fortran source code linting to MPAS dynamical core CI workflows - #435
Merged
kuanchihwang merged 9 commits intoOct 21, 2025
Merged
Conversation
…statements Original linter error message was: C183 'stat' used without 'errmsg'
Original linter error message was: C002 Interface 'function' missing 'implicit none' C002 Interface 'subroutine' missing 'implicit none'
Original linter error message was: C051 Trailing backslash The sequence of a trailing backslash followed by a newline will be interpreted as a continued line by the C preprocessor (`cpp`). According to its documentation, there is no way to prevent a backslash at the end of a line from being interpreted as a backslash-newline sequence. Unfortunately, some code comments contain LaTeX markups to express equations. In LaTeX, `\\` is used to indicate the end of a row, but it is being misinterpreted by the C preprocessor as a continued line. Work around this problem by adding the optional length argument (e.g., `[0pt]`) to `\\`.
Original linter error message was: S104 Should be 0 space after the opening bracket
Do not group variable declarations that are not related together.
This compiler warning appears when MPAS dynamical core is compiled in single precision mode: "Conversion from REAL(4) to REAL(8) at (1) [-Wconversion-extra]"
kuanchihwang
marked this pull request as ready for review
October 15, 2025 18:08
mgduda
reviewed
Oct 16, 2025
| ] | ||
| # When ignoring a linting rule, a reason should be provided. | ||
| ignore = [ | ||
| 'C003', # Temporarily ignored due to NVIDIA HPC SDK having abysmal support for Fortran 2018. |
Collaborator
There was a problem hiding this comment.
We could consider using more diplomatic language as well as adding more specificity here with something like
Temporarily ignored due to lack of support for Fortran 2018 'implicit none (external)' in the NVIDIA HPC SDK (as of the 25.9 release)
Collaborator
Author
There was a problem hiding this comment.
I revised the linting rule comments in e6f05e4.
mgduda
approved these changes
Oct 20, 2025
nusbaume
approved these changes
Oct 21, 2025
nusbaume
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @kuanchihwang! At some point it would be good to discuss how we could eventually expand the fortitude linting across all of CAM-SIMA and/or atmospheric_physics (I have a few ideas), but for now I think this is a great start!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tag name (required for release branches):
None
Originator(s):
kuanchihwang
Descriptions (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
This PR adds Fortran source code linting to MPAS dynamical core CI workflows. Fortran source code linting is powered by Fortitude. Its documentation can be found here.
Note that, currently, the output of Fortitude is for informational purposes only. Linting rule violations are configured to not fail the CI workflows. It is up to the developers to decide whether to fix them.
With Fortran source code linting now in place, this PR also fixes the following linting errors:
Describe any changes made to the build system:
None
Describe any changes made to the namelist:
None
List any changes to the defaults for the input datasets (e.g., boundary datasets):
None
List all files eliminated and why:
None
List all files added and what they do:
List all existing files that have been modified, and describe the changes:
Regression tests:
Except for the known failing test above, all the other tests pass with respect to the last baseline,
sima0_08_003.