Skip to content

Introduce source code linting to CAM-SIMA Fortran CI - #530

Merged
kuanchihwang merged 24 commits into
ESCOMP:developmentfrom
kuanchihwang:staging/add-fortitude-to-ci
Aug 5, 2026
Merged

Introduce source code linting to CAM-SIMA Fortran CI#530
kuanchihwang merged 24 commits into
ESCOMP:developmentfrom
kuanchihwang:staging/add-fortitude-to-ci

Conversation

@kuanchihwang

@kuanchihwang kuanchihwang commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Tag name

None (Bit-for-bit)

Originator(s)

kuanchihwang

Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number)

This PR introduces source code linting via Fortitude to the CAM-SIMA Fortran CI pipeline. The Fortitude configuration is located at test/fortitude.toml.

Running fortitude --config-file ./test/fortitude.toml check ./src currently generates 40000+ linter errors in the CAM-SIMA codebase. While many of them are stylistic, others reveal real code quality concerns related to correctness, modernization, and portability.

To avoid bombarding ourselves and contributors with the sheer number of existing linter errors, this PR takes a more incremental approach: Only the Fortran files that are changed in a PR are checked and reported. This allows us to gradually improve the CAM-SIMA codebase over time.

As a demonstration, this PR fixes the following linter errors in the cam_logfile module:

  • 22:4 MOD051 save statement is superfluous at the module level
  • 53:1 S233 Keyword CONTAINS should be contains
  • 97:10 C043 File opened without the action specifier
  • 100:41 C183 iostat used without iomsg
  • 128:35 S241 String uses double quotes but single quotes are preferred
  • 134:7 S271 use statements are not sorted
  • 169:7 S271 use statements are not sorted
  • 170:7 C122 use for intrinsic module missing the intrinsic modifier

The full linter output can be inspected in the CI logs.

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., initial, boundary datasets)

None

List all files eliminated and why

None

List all files added and what they do

A       test/fortitude.toml
    * Introduce Fortitude linting to CAM-SIMA Fortran CI

List all existing files that have been modified, and describe the changes

M       .github/workflows/cam_sima_fortran_ci.yml
    * Update GHA versions again
    * Remove unnecessary escapes for forward slashes
    * Introduce Fortitude linting to CAM-SIMA Fortran CI
M       .github/workflows/mpas_dynamical_core_ci.yml
    * Update GHA versions again
    * Pin Fortitude to 0.9.*
    * Should update `pip` itself before any other package operations
    * Update Fortitude configuration
    * Remove unnecessary escapes for forward slashes
    * Save matched paths for use with subsequent CI jobs
M       src/control/cam_logfile.F90
    * Do not use magic number for standard output
    * Fix linter error: MOD051 `save` statement is superfluous at the module level
    * Fix linter error: S233 Keyword `CONTAINS` should be `contains`
    * Fix linter error: C043 File opened without the `action` specifier
    * Fix linter error: C183 `iostat` used without `iomsg`
    * Fix linter error: S241 String uses double quotes but single quotes are preferred
    * Fix linter error: S271 `use` statements are not sorted
    * Fix linter error: C122 `use` for intrinsic module missing the `intrinsic` modifier
M       src/dynamics/mpas/assets/fortitude_config.toml
    * Update Fortitude configuration

Regression tests

  • derecho/aux_sima_gnu

Pass.

  • derecho/aux_sima_intel
  SMS_Ln9.ne3pg3_ne3pg3_mg37.FKESSLER.derecho_intel.cam-outfrq_se_cslam_multitape (Overall: NLFAIL) details:
    FAIL SMS_Ln9.ne3pg3_ne3pg3_mg37.FKESSLER.derecho_intel.cam-outfrq_se_cslam_multitape NLCOMP

Known failing test.

  • derecho/aux_sima_nvhpc

Pass.

@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS July 27, 2026 18:09 — with GitHub Actions Inactive
@kuanchihwang
kuanchihwang marked this pull request as ready for review July 27, 2026 18:22
@kuanchihwang
kuanchihwang requested a review from nusbaume July 27, 2026 18:22
Also guard against zero command line arguments for Fortitude.
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS July 28, 2026 18:42 — with GitHub Actions Inactive
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS July 30, 2026 17:39 — with GitHub Actions Inactive
@nusbaume
nusbaume requested a review from jimmielin August 3, 2026 19:50

@jimmielin jimmielin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is really cool, thanks @kuanchihwang. I just had a couple of potential changes for your consideration but nothing blocking the review.

Comment thread test/fortitude.toml
Comment thread .github/workflows/cam_sima_fortran_ci.yml Outdated
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS August 4, 2026 19:50 — with GitHub Actions Inactive
@jimmielin

Copy link
Copy Markdown
Collaborator

Thanks @kuanchihwang for addressing my comments!

@peverwhee
peverwhee requested review from peverwhee and removed request for nusbaume August 4, 2026 21:11

@peverwhee peverwhee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

one question and a couple requests on the SIMA toml file. thanks @kuanchihwang !

Comment thread src/control/cam_logfile.F90
Comment thread test/fortitude.toml Outdated
Comment thread test/fortitude.toml Outdated
Comment thread test/fortitude.toml
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS August 4, 2026 23:33 — with GitHub Actions Inactive
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS August 5, 2026 19:39 — with GitHub Actions Inactive

@peverwhee peverwhee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks @kuanchihwang !

@peverwhee

Copy link
Copy Markdown
Collaborator

@kuanchihwang you can go ahead and merge this whenever you're ready

@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS August 5, 2026 23:23 — with GitHub Actions Inactive
@kuanchihwang
kuanchihwang merged commit 0c07dc9 into ESCOMP:development Aug 5, 2026
30 checks passed
@kuanchihwang
kuanchihwang deleted the staging/add-fortitude-to-ci branch August 6, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants