Skip to content

Add capability to exclude individual Fortran files from Codee formatting in GitHub actions#732

Merged
mkavulich merged 16 commits into
NCAR:developfrom
climbfuji:bugfix/breaks
Apr 8, 2026
Merged

Add capability to exclude individual Fortran files from Codee formatting in GitHub actions#732
mkavulich merged 16 commits into
NCAR:developfrom
climbfuji:bugfix/breaks

Conversation

@climbfuji

@climbfuji climbfuji commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds the capability to exclude individual Fortran files from Codee formatting in GitHub actions. This was originally motivated by issues with making the Fortran writer Codee compliant (PR #727). These issues were resolved, but there are scenarios were excluding individual files from Codee formatting checks may be needed (see comments in #727).

User interface changes?: No

Issues

N/A

Testing

Testing: all pass (only updates to existing tests, no new tests, no tests removed)

Additional information

See comments in #727

Steve Goldhaber and others added 9 commits March 21, 2026 23:09
Add missing spaces in host cap (for Codee).
…' and 'code format on' blocks (test/unit_tests/sample_files/fortran_files/{linebreak_test.F90,comments_test.F90,long_string_test.F90})
….F90` (NCAR#722)

1. Add threading test to `capgen_test`. This is exercised with `ctest`
without any further changes, and it passes. I added a comparison of all
averages to the `compare_data` call, which compares the `omp1` and
`omp2` test runs. This is commit
NCAR@900069b.
While testing this, @peverwhee and I uncovered a bug (uninitialized
variable, see
NCAR#722 (comment))
that I had to fix.
2. Update Codee to 2025.4.8 and simplify
`.github/workflows/fortran-formatting.yaml` (there was an actual error
using the workflow that needed to be fixed). This is commit
NCAR@a76f82c
3. Codee format `test/capgen_test/*.F90`. This is commit
NCAR@24223ff

User interface changes?: No

Issues: Working toward NCAR#721

Testing: all pass
  test removed: n/a
  unit tests: n/a
system tests: existing capgen test now run with `OMP_NUM_THREADS=1` and
`OMP_NUM_THREADS=2`
manual testing: tested manually on my dev machine with spack-stack-2.1.0
…cl (NCAR#726)

Fix TypeError from ParseSyntaxError in parse_fortran_var_decl

In `parse_fortran_var_decl()`, when `FortranVar()` raises a
  `ParseSyntaxError`, the exception object was appended directly
  to the errors list. `parse_module` expects string elements and calls
  `'\n'.join(errors)`, which crashes with a `TypeError`. Convert
  the exception to a string before appending.

From the context above `errmsg` is already being appended to
  `errors` array so I think this is a safe change to make that is
  consistent with the intended type of `errors[]`.

User interface changes?: No

Fixes: closes NCAR#725 

Testing:
  unit tests: New doctest for parse_fortran_var_decl() covers previous error
  manual testing: see minimal reproducible example in issue NCAR#725
@climbfuji climbfuji changed the title Add more break points for long lines (PR 727) with Codee fixes Add more break points for long lines (PR 727) with Codee fixes (exclude files from formatting) Apr 3, 2026
@climbfuji climbfuji marked this pull request as ready for review April 3, 2026 13:53
@climbfuji climbfuji requested review from a team and gold2718 as code owners April 3, 2026 13:53
@climbfuji climbfuji requested a review from cacraigucar April 3, 2026 13:53

@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 @climbfuji !

Comment thread scripts/fortran_tools/fortran_write.py Outdated
@climbfuji climbfuji changed the title Add more break points for long lines (PR 727) with Codee fixes (exclude files from formatting) Add capability to exclude individual Fortran files from Codee formatting in GitHub actions Apr 6, 2026
@climbfuji climbfuji requested a review from peverwhee April 6, 2026 17:07
@climbfuji

Copy link
Copy Markdown
Collaborator Author

@gold2718 Ready for your review

@gold2718 gold2718 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.

Looks good.

@dustinswales dustinswales left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@climbfuji

Copy link
Copy Markdown
Collaborator Author

@mkavulich Looks like we have all the approvals we need to merge.

@mkavulich mkavulich merged commit 36b6052 into NCAR:develop Apr 8, 2026
15 checks passed
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.

6 participants