From 5817eafd28bac7af7383f0b3985074fd0857df70 Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon Date: Fri, 20 Mar 2026 17:47:46 +0000 Subject: [PATCH 1/8] started docs and all links added work --- source/Development/TestSuites/lfric_apps.rst | 2 + source/FurtherDetails/fortitude_linter.rst | 80 ++++++++++++++++++++ source/FurtherDetails/index.rst | 1 + 3 files changed, 83 insertions(+) create mode 100644 source/FurtherDetails/fortitude_linter.rst diff --git a/source/Development/TestSuites/lfric_apps.rst b/source/Development/TestSuites/lfric_apps.rst index 1f50cbb0..c2870085 100644 --- a/source/Development/TestSuites/lfric_apps.rst +++ b/source/Development/TestSuites/lfric_apps.rst @@ -85,3 +85,5 @@ below, with ``name`` matching the directory name of the area. | | e.g. gungho_developer or lfric_atm_spice | +--------------------+----------------------------------------------------------+ + +:doc:`Instructions for resolving fortitude lint errors: <../../FurtherDetails/fortitude_linter>` \ No newline at end of file diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst new file mode 100644 index 00000000..a836f55a --- /dev/null +++ b/source/FurtherDetails/fortitude_linter.rst @@ -0,0 +1,80 @@ +.. ----------------------------------------------------------------------------- + (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: +``_ + +Lint Rules and their Codes: +``_ + + + +Re-running Fortitude to fix lint errors +======================================== + +Lint errors go to job.err and you can see the: repository name, file, rule code, +rule name, number of errors in each repo, auto-fix options, and a summary of +repos 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. You may be able to +use fortitude to run an automatic fix - this is rule-dependent and Fortitude +prints if the rule has that option under the error message. +See instructions below on how to do run with :ref:`automatic fixing ` + +Testing with Test Suite: +------------------------ + +Run these commands from the inside the top directory of the codebase. + +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: +---------------------------------------- + +With the either the A rule code, or B configuration file specified, +and specific files to run on specified: +N.B. If you don’t specify rules or a config file, you will get lots of errors +unrelated to your changes (that already exist in the codebase), so it is +advised you do specify them. +The rule code associated with the error is given in the job.err report. +If the repository with the error uses the universal configuartion +(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 these commands from the inside the top directory of the codebase. + + +.. _auto_fix: + +Testing with auto-fix option: +---------------------------------------- +Some errors can be fixed automatically by fortitude. This is rule dependent +and Fortitude will let you know if the specific failure has this option under +each error listed. + +fortitude check --select rule_code --fix ./path_to_file_with_lint_error +e.g. fortitude check --select S101 --fix ./applications/lfricinputs diff --git a/source/FurtherDetails/index.rst b/source/FurtherDetails/index.rst index 83d2c37b..f2fd76ef 100644 --- a/source/FurtherDetails/index.rst +++ b/source/FurtherDetails/index.rst @@ -20,5 +20,6 @@ Further Details contributing ai dos_donts + fortitude_linter change_notes coding_style From ac2400526ea29f67fe7f400641eb2b936d372078 Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon Date: Tue, 24 Mar 2026 14:50:18 +0000 Subject: [PATCH 2/8] added all content and tested build --- source/Development/TestSuites/lfric_apps.rst | 7 +- source/FurtherDetails/fortitude_linter.rst | 108 ++++++++++++++----- 2 files changed, 85 insertions(+), 30 deletions(-) diff --git a/source/Development/TestSuites/lfric_apps.rst b/source/Development/TestSuites/lfric_apps.rst index c2870085..14f70406 100644 --- a/source/Development/TestSuites/lfric_apps.rst +++ b/source/Development/TestSuites/lfric_apps.rst @@ -85,5 +85,10 @@ below, with ``name`` matching the directory name of the area. | | e.g. gungho_developer or lfric_atm_spice | +--------------------+----------------------------------------------------------+ +Fortitude Linter +---------------- -:doc:`Instructions for resolving fortitude lint errors: <../../FurtherDetails/fortitude_linter>` \ No newline at end of file +The rose-stem suite has a job that runs Fortitude which will fail if your +fortran code introduces lint or style errors. The job can be re-run on its own +through the test suite or separately: +:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` \ No newline at end of file diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index a836f55a..e20a5164 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -24,26 +24,28 @@ Lint Rules and their Codes: Re-running Fortitude to fix lint errors ======================================== -Lint errors go to job.err and you can see the: repository name, file, rule code, -rule name, number of errors in each repo, auto-fix options, and a summary of -repos 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. You may be able to -use fortitude to run an automatic fix - this is rule-dependent and Fortitude -prints if the rule has that option under the error message. -See instructions below on how to do run with :ref:`automatic fixing ` +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 ` 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. +Run these commands from the inside the top directory of the codebase: -Can re-run fortitude_linter individually: +- 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: +- Or with scripts group: .. code-block:: shell @@ -53,28 +55,76 @@ Or with scripts group: Testing manually from the terminal: ---------------------------------------- -With the either the A rule code, or B configuration file specified, -and specific files to run on specified: -N.B. If you don’t specify rules or a config file, you will get lots of errors -unrelated to your changes (that already exist in the codebase), so it is -advised you do specify them. -The rule code associated with the error is given in the job.err report. -If the repository with the error uses the universal configuartion -(lfric_apps/rose-stem/app/check_fortitude_linter/file/fortitude.toml) +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. + +If the repository 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. +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 the lfric environment:** + +.. 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`` + + + + -Run these commands from the inside the top directory of the codebase. -.. _auto_fix: -Testing with auto-fix option: ----------------------------------------- -Some errors can be fixed automatically by fortitude. This is rule dependent -and Fortitude will let you know if the specific failure has this option under -each error listed. -fortitude check --select rule_code --fix ./path_to_file_with_lint_error -e.g. fortitude check --select S101 --fix ./applications/lfricinputs From 7367b483aa81654f46ffd664db499103272a5383 Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon Date: Tue, 24 Mar 2026 14:54:06 +0000 Subject: [PATCH 3/8] added link in lfric core as well and tested build --- source/Development/TestSuites/lfric_core.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/Development/TestSuites/lfric_core.rst b/source/Development/TestSuites/lfric_core.rst index efc288eb..68d0747e 100644 --- a/source/Development/TestSuites/lfric_core.rst +++ b/source/Development/TestSuites/lfric_core.rst @@ -37,3 +37,12 @@ developer suite). It is also possible to run on a single platform, eg. ``-z group=ex1a``. To select which meto EX machine is used, add ``-S USE_EX=true``. + + +Fortitude Linter +---------------- + +The rose-stem suite has a job that runs Fortitude which will fail if your +fortran code introduces lint or style errors. The job can be re-run on its own +through the test suite or separately: +:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` \ No newline at end of file From d06dfe84b380c3ae0f661ec4998434e98b9f4344 Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon Date: Tue, 24 Mar 2026 16:28:06 +0000 Subject: [PATCH 4/8] sorted lint errors --- source/Development/TestSuites/lfric_apps.rst | 6 ++-- source/Development/TestSuites/lfric_core.rst | 6 ++-- source/FurtherDetails/fortitude_linter.rst | 31 +++++++------------- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/source/Development/TestSuites/lfric_apps.rst b/source/Development/TestSuites/lfric_apps.rst index 14f70406..39feb309 100644 --- a/source/Development/TestSuites/lfric_apps.rst +++ b/source/Development/TestSuites/lfric_apps.rst @@ -88,7 +88,7 @@ below, with ``name`` matching the directory name of the area. Fortitude Linter ---------------- -The rose-stem suite has a job that runs Fortitude which will fail if your -fortran code introduces lint or style errors. The job can be re-run on its own +The rose-stem suite has a job that runs Fortitude which will fail if your +fortran code introduces lint or style errors. The job can be re-run on its own through the test suite or separately: -:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` \ No newline at end of file +:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` diff --git a/source/Development/TestSuites/lfric_core.rst b/source/Development/TestSuites/lfric_core.rst index 68d0747e..fd400800 100644 --- a/source/Development/TestSuites/lfric_core.rst +++ b/source/Development/TestSuites/lfric_core.rst @@ -42,7 +42,7 @@ select which meto EX machine is used, add ``-S USE_EX=true``. Fortitude Linter ---------------- -The rose-stem suite has a job that runs Fortitude which will fail if your -fortran code introduces lint or style errors. The job can be re-run on its own +The rose-stem suite has a job that runs Fortitude which will fail if your +fortran code introduces lint or style errors. The job can be re-run on its own through the test suite or separately: -:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` \ No newline at end of file +:doc:`Instructions for resolving fortitude lint errors <../../FurtherDetails/fortitude_linter>` diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index e20a5164..a7a400b6 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -24,14 +24,14 @@ Lint Rules and their Codes: 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, +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 +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 ` by fortitude. -This is rule dependent and Fortitude will let you know if the specific failure has this +N.B. Some errors can be :ref:`fixed automatically ` 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: @@ -55,18 +55,18 @@ Run these commands from the inside the top directory of the codebase: 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 +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. -If the repository 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 +If the repository 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 +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: @@ -119,12 +119,3 @@ Add ``--fix`` after the "check" in the command: 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`` - - - - - - - - - From 8e1371cecbb0ab6e77923fae981deb5244211aae Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon <120176477+mo-lucy-gordon@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:52:12 +0000 Subject: [PATCH 5/8] review suggestion 1 Co-authored-by: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> --- source/FurtherDetails/fortitude_linter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index a7a400b6..e41e130d 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -62,7 +62,7 @@ errors in the codebase that are unrelated to your changes. The rule code associated with the error is given in the job.err report. -If the repository with the error uses the universal configuration +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. From 3998883581d8426b7175dfca0567eebdb33d9284 Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon <120176477+mo-lucy-gordon@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:53:25 +0000 Subject: [PATCH 6/8] review suggestion 2 Co-authored-by: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> --- source/FurtherDetails/fortitude_linter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index e41e130d..0fd98afe 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -71,7 +71,7 @@ directory e.g. *lfric_apps/lfricinputs/fortitude.toml*. Run the following commands from the inside the top directory of the codebase: -**First, load the lfric environment:** +**First, load an environment with fortitude available** .. code-block:: shell From 178b860f217ba085aad2aca339502dee6e720e4a Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon <120176477+mo-lucy-gordon@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:53:42 +0000 Subject: [PATCH 7/8] review suggestion 3 Co-authored-by: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> --- source/FurtherDetails/fortitude_linter.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index 0fd98afe..5199bab0 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -75,6 +75,7 @@ Run the following commands from the inside the top directory of the codebase: .. code-block:: shell + # eg. For Met Office VDI's ml use ~lfricadmin/lmod module load lfric From 4e15523178c18f83afc1ab3c69c8ea4533cad4fd Mon Sep 17 00:00:00 2001 From: mo-lucy-gordon Date: Wed, 25 Mar 2026 17:59:35 +0000 Subject: [PATCH 8/8] change to clarification placement --- source/FurtherDetails/fortitude_linter.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/FurtherDetails/fortitude_linter.rst b/source/FurtherDetails/fortitude_linter.rst index 5199bab0..03feabd8 100644 --- a/source/FurtherDetails/fortitude_linter.rst +++ b/source/FurtherDetails/fortitude_linter.rst @@ -71,11 +71,12 @@ 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** +**First, load an environment with fortitude available.** + +E.g. For Met Office VDI's: .. code-block:: shell - # eg. For Met Office VDI's ml use ~lfricadmin/lmod module load lfric