F/gh action tab check - #3469
Open
andrew-platt wants to merge 2 commits into
Open
andrew-platt wants to merge 2 commits into
andrew-platt wants to merge 2 commits into
Conversation
OpenFAST style requires 3 space indentation in Fortran source; tab characters are not allowed because they render inconsistently across editors and break continuation-line alignment. Add a workflow that scans every git-tracked *.f90 / *.F90 file and reports the file, line, and column of each tab found, failing the job if any are present. Findings are also emitted as GitHub annotations so they appear inline on the pull request diff. Registry-generated *_Types.f90 files are excluded from the scan, since they are produced by the OpenFAST Registry rather than edited by hand. Also remove the 7 pre-existing tab characters so the check passes on a clean tree. All were in comments or whitespace-only lines, so there is no change in behavior. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The omega_P description in StrucCtrl_Registry.txt contained tab characters, which the Registry copied verbatim into the generated Doxygen comment in StrucCtrl_Types.f90. Replace them with spaces, matching the alignment of the neighboring alpha_P entry, and regenerate StrucCtrl_Types.f90. Comment text only; no change in behavior. Assisted-by: LLM [Claude Code] [Copilot]
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new CI check script currently has error-handling gaps that can mask failures (e.g., ineffective git-root guard and treating grep errors as “no matches”), which could allow tabs to slip through undetected.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR adds a GitHub Actions workflow and companion script to enforce the OpenFAST Fortran style rule that git-tracked .f90/.F90 sources must not contain tab characters, and cleans up existing tabs so the new check passes.
Changes:
- Add a new GitHub Actions workflow to run the tab check on relevant pushes and on all pull requests.
- Add a bash script that enumerates tracked Fortran sources, reports tab locations (with GitHub
::errorannotations), and fails CI if any are found. - Remove existing tab characters / tab-only whitespace from several Fortran sources and update the ServoDyn registry description string and regenerated
_Types.f90output accordingly.
File summaries
| File | Description |
|---|---|
.github/workflows/check-tabs.yml |
Adds CI workflow wiring to run the repository tab scan on PRs and relevant pushes. |
.github/scripts/check_tabs.sh |
Implements the tab detection and GitHub annotation reporting logic. |
modules/lindyn/src/LinDyn.f90 |
Removes tabs from comment block lines so the new check passes. |
modules/moordyn/src/MoorDyn_Line.f90 |
Removes a leading tab from a commented-out line. |
modules/nwtc-library/Old_test/Test_MeshMapping/Test_MeshMapping_Mod.f90 |
Replaces tab-only/whitespace-only lines with empty lines. |
modules/nwtc-library/src/NWTC_Num.f90 |
Removes a tab from a Doxygen/math comment line. |
modules/servodyn/src/StrucCtrl_Registry.txt |
Replaces tabs inside a quoted description string to prevent tabs from propagating into generated Fortran. |
modules/servodyn/src/StrucCtrl_Types.f90 |
Updates the regenerated comment spacing for omega_P to remove tabs. |
Review details
- Files reviewed: 2/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| n_bad_lines=0 | ||
|
|
||
| for file in "${FILES[@]}"; do | ||
| matches=$(grep -n -- "$TAB" "$file") || continue |
| TAB=$(printf '\t') | ||
| MARK='--->' | ||
|
|
||
| cd "$(git rev-parse --show-toplevel)" || exit 1 |
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.
PR: Add GitHub action to check Fortran source for tab characters
Base branch:
rc-5.0.1Head branch:
f/GH_action_tab_checkCommits:
316018d32,bf06cde90Diffstat: 8 files changed, 116 insertions(+), 9 deletions(-)
Feature or improvement description
Adds a CI check that enforces the OpenFAST Fortran source style rule that tab
characters are not allowed. OpenFAST style requires 3 space indentation; tabs
render inconsistently across editors and break the alignment of continuation
lines, so they should never reach the repository.
Two files are added:
.github/workflows/check-tabs.yml-- aFortran Source Styleworkflow thatruns on pushes touching
**.f90/**.F90(or the check's own files) and onevery pull request. It checks out with
submodules: false, so ther-testsubmodule is never scanned.
.github/scripts/check_tabs.sh-- the check itself. It enumerates sourcefiles with
git ls-files -- '*.f90' '*.F90', so out-of-tree builddirectories and untracked scratch files are excluded by construction. Every
tab found is reported with its file, line number, and column, and the
offending line is echoed with tabs rendered as
--->. The job exits non-zeroif any tab is found.
Sample output:
Each hit is additionally emitted as a GitHub
::error file=...,line=...,col=...::annotation, so findings appear inline on the pull request diff rather than only
in the job log.
This pull request also removes the tab characters that were already present in
the source tree -- 20 tabs spanning 8 lines across 5 files -- so the check
passes on a clean tree.
Related issue, if one exists
None.
Impacted areas of the software
Continuous integration only. No compiled behavior changes.
.github/workflows/check-tabs.yml.github/scripts/check_tabs.shmodules/lindyn/src/LinDyn.f90modules/moordyn/src/MoorDyn_Line.f90modules/nwtc-library/Old_test/.../Test_MeshMapping_Mod.f90modules/nwtc-library/src/NWTC_Num.f90modules/servodyn/src/StrucCtrl_Registry.txtomega_Pdescription stringmodules/servodyn/src/StrucCtrl_Types.f90Every source edit is confined to comments or whitespace-only lines. No
executable statement, declaration, interface, or registry type definition was
modified, so no module behavior changes and no regression test output should
move.
Additional supporting information
Design decisions worth noting for review:
Registry-generated files.
*_Types.f90files are excluded from the scan,since they are produced by the OpenFAST Registry rather than edited by hand.
A tab in one of them indicates a problem in the corresponding registry input,
not in code a developer can fix in place.
The ServoDyn fix demonstrates exactly that case.
StrucCtrl_Types.f90heldfour tabs inside the Doxygen comment for
omega_P. The Registry had copiedthem verbatim from the quoted description string at
StrucCtrl_Registry.txt:141. The fix was made in the registry input, aligningthe string with the neighboring
alpha_Pentry, andStrucCtrl_Types.f90wasregenerated. The regeneration produced exactly the one expected line change
and no other churn, confirming the committed generated file was in sync with
its input beforehand.
Registry
.txtfiles are out of scope by design. They are tab-delimited asa matter of format, so they are correctly not scanned. Only tabs that leak
into a quoted description string reach generated Fortran, and those are caught
indirectly through review rather than by this check.
The
_Types.f90exclusion is currently not load-bearing. After this pullrequest, no tracked
.f90/.F90file in the tree contains a tab, generatedfiles included. The exclusion is retained as a guard: without it, a stray tab
in any registry description string would fail CI on a file no developer can
hand-edit. Reviewers who would rather check everything can simply drop the
grep -v '_Types\.f90$'filter incheck_tabs.sh.Generative AI usage
Substantial portions of this work were AI-assisted.
and the four comment/whitespace cleanups in
LinDyn.f90,MoorDyn_Line.f90,Test_MeshMapping_Mod.f90, andNWTC_Num.f90, and tracedthe
StrucCtrl_Types.f90tab back to its registry source.StrucCtrl_Registry.txtdescription-stringedit.
StrucCtrl_Types.f90was run by the author.Trailers present on the branch commits:
Test results, if applicable
None suggested.