-
Notifications
You must be signed in to change notification settings - Fork 14
Add fortitude instructions #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
James Bruten (james-bruten-mo)
merged 8 commits into
MetOffice:main
from
mo-lucy-gordon:add_fortitude_instructions
Mar 26, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5817eaf
started docs and all links added work
mo-lucy-gordon ac24005
added all content and tested build
mo-lucy-gordon 7367b48
added link in lfric core as well and tested build
mo-lucy-gordon d06dfe8
sorted lint errors
mo-lucy-gordon 8e1371c
review suggestion 1
mo-lucy-gordon 3998883
review suggestion 2
mo-lucy-gordon 178b860
review suggestion 3
mo-lucy-gordon 4e15523
change to clarification placement
mo-lucy-gordon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| .. ----------------------------------------------------------------------------- | ||
| (c) Crown copyright Met Office. All rights reserved. | ||
| The file LICENCE, distributed with this code, contains details of the terms | ||
| under which the code may be used. | ||
| ----------------------------------------------------------------------------- | ||
|
|
||
| .. _fortitude_linter: | ||
|
|
||
| ======================================== | ||
| Fortitude Linter | ||
| ======================================== | ||
|
|
||
| Fortitude is a fortran linter that runs automatically when you run the test | ||
| suite. Links to the official documentation are included below: | ||
|
|
||
| Command line interface: | ||
| `<https://fortitude.readthedocs.io/en/stable/configuration/#full-command-line-interface>`_ | ||
|
|
||
| Lint Rules and their Codes: | ||
| `<https://fortitude.readthedocs.io/en/stable/rules/>`_ | ||
|
|
||
|
|
||
|
|
||
| Re-running Fortitude to fix lint errors | ||
| ======================================== | ||
|
|
||
| Lint errors go to job.err and in that report you can also see the: rule code, rule name, | ||
| auto-fix options, and a summary of the repositories with errors at the bottom of the report. | ||
|
|
||
| When you have resolved the lint issue, see the instructions below on how to | ||
| re-test quickly. | ||
|
|
||
| N.B. Some errors can be :ref:`fixed automatically <auto-fix>` by fortitude. | ||
| This is rule dependent and Fortitude will let you know if the specific failure has this | ||
| option under each error listed. | ||
|
|
||
| Testing with Test Suite: | ||
| ------------------------ | ||
|
|
||
| Run these commands from the inside the top directory of the codebase: | ||
|
|
||
| - You can re-run fortitude_linter individually: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| cylc vip -z group=fortitude_linter -n suite_name ./rose-stem | ||
|
|
||
| - Or with scripts group: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| cylc vip -z group=scripts -n suite_name ./rose-stem | ||
|
|
||
|
|
||
| Testing manually from the terminal: | ||
| ---------------------------------------- | ||
|
|
||
| The following commands run fortitude on specific files and specify the rule or | ||
| configuration file. | ||
| Fortitude can be run without specifying these things but it may pick up existing | ||
| errors in the codebase that are unrelated to your changes. | ||
|
|
||
| The rule code associated with the error is given in the job.err report. | ||
|
|
||
| For the LFRic repositories, if the application with the error uses the universal configuration | ||
| (*lfric_apps/rose-stem/app/check_fortitude_linter/file/fortitude.toml*) | ||
| for its fortitude tests, the job.out specifies that in that repo’s output | ||
| section. | ||
| Otherwise, it will use its own configuration file, located in its top | ||
| directory e.g. *lfric_apps/lfricinputs/fortitude.toml*. | ||
|
|
||
| Run the following commands from the inside the top directory of the codebase: | ||
|
|
||
| **First, load an environment with fortitude available.** | ||
|
|
||
| E.g. For Met Office VDI's: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| ml use ~lfricadmin/lmod | ||
| module load lfric | ||
|
|
||
| **Then run fortitude with 1) the rule code, or 2) the config file :** | ||
|
|
||
| **1) With rule code:** | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| fortitude check --select rule_code ./path_to_file_with_lint_error | ||
|
|
||
| **2) With config file specified:** | ||
|
|
||
| 2.A) If app/repo has its own configuration (.toml) file: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| fortitude --config-file ./path_to_repo_config_file check ./path_to_test_repo | ||
|
|
||
| 2.B) If it uses the universal configuration (see job.out) then use this file path to it: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| fortitude --config-file ./rose-stem/app/check_fortitude_linter/file/fortitude.toml check ./path_to_repo_to_check | ||
|
|
||
| .. _auto-fix: | ||
|
|
||
| **If an automatic fix is available:** | ||
|
|
||
| Add ``--fix`` after the "check" in the command: | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| fortitude --config-file ./path_to_repo_config_file check --fix ./path_to_file_with_lint_error | ||
|
|
||
| **Example commands:** | ||
|
|
||
| ``fortitude check --select S101 ./applications/lfricinputs`` | ||
|
|
||
| ``fortitude check --select S101,PORT011 ./applications/lfricinputs`` | ||
|
|
||
| where S101, or S101 and PORT011 are the lint rule(s) you want to test with. | ||
|
|
||
| ``fortitude --config-file ./applications/lfricinputs/fortitude.toml check ./applications/lfricinputs`` | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,5 +20,6 @@ Further Details | |
| contributing | ||
| ai | ||
| dos_donts | ||
| fortitude_linter | ||
| change_notes | ||
| coding_style | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.