FortifyFortran Formatting Tool OverviewFortify is a Fortran formatting tool designed to help developers maintain consistent and readable code. It provides various features to handle spacing, indentation, and other formatting aspects of Fortran code. FeaturesStructure IndentationWill properly indent and nest if, do, subroutine, program, and any other keyword statements that can be ended with an In the case of the do-continue F77 statement, it will find the matching goto-continue and unindent on that. This will work even in a do-loop that contains multiple do's that end on the same continue. Note: All fixed format files will have the first 6 columns reserved, while all free format files use every column Tab indentation lengthYou may set the tab length to either 2, 3, or 4. It is set to 3 by default. Logical/Relational/Math Operator SpacingAdds spaces around operators such as Special care is taken for Tab character replacementConverts the Comment spacing preservationWill retain the original spacing between a line comment and a the code. This is done since it is a common practice to have comments lined up in a series after related code. Lines which are only comments are kept on the first column and kept this way. This can be user defined. Skip line formatting optionIf you wish for a line to skip formatting, simply add Free format featuresComment line treatmentThis allows comment-only lines (lines which only have comments them, no executable code) to moved around in 1 of 3 ways; either indent them with the rest of the code, leave them as is, or move them all to the first column. The default is indent. You can change this behavior in the settings. Fixed format featuresContinuation CharacterIn older Fortran, any character may become the continuation character. This formatter enforces the modern Comment CharacterIn older Fortran, Line Carry OverManages line continuation by finding appropriate places to break lines and carry over to the next line, ensuring code remains within the specified column width. The final usable line is default set to 72, but can be set to 132 in the settings. Other FeaturesCode modernization techinquesBy default, it will lower all non-string code. As Fortran is case-insensitive, this does change any code logic, and modernizes the all CAP past of older Fortran code. This may be changed in the user settings. Parenthesis SpacingRemoves spaces formatting for objects around and inside parentheses Remove Extra SpaceRemoves unnecessary double spacing in a code line to maintain clean and readable code. Comma SpacingHandles spacing around commas to ensure there is a space after each comma, improving readability. String HandlingProperly handles strings enclosed in single or double quotes, ensuring they are not broken or improperly formatted. User defined inputsMany defaults are set to the modern Fortran standard, but are able to be re-defined by the user. These include:
| Variable | Default Value | Values | Format | Description |
|----------|---------------|--------|-------------|-------------|
| Comment Character | UsageTo use Fortify, simply run the tool on your Fortran source files. The tool will automatically apply the formatting rules and update the files accordingly. InstallationTo install Fortify, clone the repository and run the setup script:
LicenseThis project is licensed under the MIT License. See the LICENSE file for details. ContactFor any questions or issues, please ask a question on the Q&A or open an issue on the GitHub repository. |