Repository navigation
fix: make a second run a no-op - #16
Merged
Merged
Conversation
…s, blanks and split-statements Running ffmt twice changed 55 of 335 real Fortran files before this. Causes fixed: - strip trailing semicolons and modernize operators before wrapping, so lines wrap at their final length - indent a comment moved above end do/else at the enclosing block depth - collapse blank runs before compaction/alignment and drop the whole run after block openers - lift comments hoisted out of continuations into ordinary comment lines so they merge like written ones - split semicolon statements before scope tracking and wrapping - treat bare commas as spaced when measuring breaks, and space top-level commas up front - do not break between ) and a space-separated %member - judge a wrapped declaration as a whole statement - do not classify `type = 0` as a type definition - keep continuation/directive lines out of align-assignments - never run the Fortran wrapper on #-lines (a Fypp Python != was moved above its statement)
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.
Running ffmt twice changed 55 of 335 real Fortran files (magudi, paris, jcode, MFC-derived code, cell codes) and, with optional passes on, MFC's own source. This fixes every case I found; all 335 files and MFC
src/are now idempotent at line lengths 60/80/90/100/132, with indent-width 2, with every optional pass on, and with an alternate config.One of these was worse than non-idempotent: a Fypp
#:set x = a.strip() != '' or ...line over the limit had its Python!=taken for a comment start, and the tail was moved above the statement (omp_macros.fpp, line length 80). Lines starting with#are no longer rewrapped.Other causes:
;and legacy operators (.lt.) were removed after wrapping, so lines wrapped at the wrong lengthend do/elsewas indented one level shortsplit-statementsran after wrapping and scope tracking, manglingdo ...; ...; enddoone-liners)and a space-separated%membertype = 0was classified as a type definitionalign-assignmentspadded continuation arguments such as& no_create=None14 regression tests are added; 13 fail on current master (the Fypp-macro one guards against a change made during this work). Real failing inputs live in
tests/fixtures/idempotence/.On MFC
src/at the default config, output differs from master in one file: five blank lines master only adds on its second run.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo build --releaseandcargo test(429) pass locally. I could not run the MFC build jobs locally.