Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ build/
build-cmake/
*Temporary
.vscode
*.egg-info
*.egg-info
.venv
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ repos:
# requires the `--config-file` option to be specified before the `check` subcommand
# and the pre-commit hook correctly states check in the entry.
- id: fortitude
entry: fortitude --config-file formatting/fortitude.toml check --force-exclude
entry: fortitude --config-file formatting/fortitude/fortitude.toml check --force-exclude
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ fpm test
[pre-commit](https://pre-commit.com/) is utilised within this repo. pre-commit is a tool to help enforce formatting standards as early as possible.
pre-commit works by running a provided set of checks every time a `git commit` is attempted.

To utilise pre-commit, it must be installed locally. This can be done in several ways but the easiest is to use the provided `pyproject.toml` via...
To utilise pre-commit, it must be installed locally. This can be done in several ways but the easiest is to use the provided `requirements.txt` via...
```
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python -m pip install -r requirements.txt
```

Then, from the root of the repo, you start using pre-commit by running
Expand Down
2 changes: 1 addition & 1 deletion formatting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

| tool | description | Known issues |
| ---- | ----------- | ------------ |
| [Fortitude](https://fortitude.readthedocs.io/en/stable/) | A [Ruff](https://docs.astral.sh/ruff/) style linter for Fortran. | |
| [Fortitude](./fortitude/) | A [Ruff](https://docs.astral.sh/ruff/) style linter for Fortran. | |
5 changes: 0 additions & 5 deletions formatting/fortitude.toml

This file was deleted.

10 changes: 7 additions & 3 deletions formatting/fortitude.md → formatting/fortitude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ A tool for installing, i.e. `pip` or `homebrew`

## Installation

To install fortitude we can utilise the provided `pyproject.toml` by following the instructions in [the pre-commit install instructions](../README.md#pre-commit). The [quickstart page](https://fortitude.readthedocs.io/en/stable/#quickstart) for Fortitude details multiple other ways of installing the tool.
To install fortitude we can utilise the provided `requirements.txt` by following the instructions in [the pre-commit install instructions](../../README.md#pre-commit).
The [quickstart page](https://fortitude.readthedocs.io/en/stable/#quickstart) for Fortitude details multiple other ways of installing the tool.

## Usage in this repo

Expand All @@ -16,11 +17,14 @@ This repo has been formatted with Fortitude. To check this repo with Fortitude,
fortitude --config-file formatting/fortitude.toml check
```

The config file, [fortitude.toml](./fortitude.toml), we have provided in the above command contains our rules which alter the [default fortitude rules](https://fortitude.readthedocs.io/en/stable/rules/).
The config file, [fortitude.toml](./fortitude.toml), we have provided in the above command contains our rules which alter the
[default fortitude rules](https://fortitude.readthedocs.io/en/stable/rules/).



### pre-commit

We have also integrated Fortitude with pre-commit. To set this up, follow the [instructions on the main README.md](../README.md#pre-commit).
We have also integrated Fortitude with pre-commit. To set this up, follow the [instructions on the main README.md](../../README.md#pre-commit).
Once this is set up, if you then try and commit a poorly formatted Fortran file...

```sh
Expand Down
9 changes: 9 additions & 0 deletions formatting/fortitude/fortitude.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[check]
# A set of rules we ignore. Fortitude will not enforce these rules.
ignore = [
"C003", # 'implicit none' missing 'external'
]

# A custom maxmum line length for our repo which will effect the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add details about the cases where this rule does not apply (eg. text-only write lines and comments)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# A custom maxmum line length for our repo which will effect the
# A custom maximum line length for our repo which will effect the

Spelling.

# behaviour of rule S001 (line-too-long)
line-length = 132
14 changes: 0 additions & 14 deletions pyproject.toml

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fortitude-lint>=0.7.2
pre-commit>=4.2.0
14 changes: 0 additions & 14 deletions testing/veggies/test_poisson_given_when_then.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ module veggies_poisson_given_when_then
contains

function test_poisson_given_when_then() result(test)
implicit none
type(test_item_t) :: test

character(len=:), allocatable :: file_name
Expand Down Expand Up @@ -73,7 +72,6 @@ function test_poisson_given_when_then() result(test)
end function test_poisson_given_when_then

function load_data_file(input) result(output)
implicit none
class(input_t), intent(in) :: input
type(transformed_t) :: output

Expand Down Expand Up @@ -109,7 +107,6 @@ function load_data_file(input) result(output)
end function load_data_file

function check_file_is_open(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -122,7 +119,6 @@ function check_file_is_open(input) result(result_)
end function check_file_is_open

function check_num_nodes(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -136,7 +132,6 @@ function check_num_nodes(input) result(result_)
end function check_num_nodes

function check_num_elements(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -150,7 +145,6 @@ function check_num_elements(input) result(result_)
end function check_num_elements

function check_num_boundary_points(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -164,7 +158,6 @@ function check_num_boundary_points(input) result(result_)
end function check_num_boundary_points

function check_element_to_node(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -180,7 +173,6 @@ function check_element_to_node(input) result(result_)
end function check_element_to_node

function check_vb_index(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -193,7 +185,6 @@ function check_vb_index(input) result(result_)
end function check_vb_index

function check_boundary_node_num(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -208,7 +199,6 @@ function check_boundary_node_num(input) result(result_)
end function check_boundary_node_num

function check_num_side_nodes(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -225,7 +215,6 @@ function check_num_side_nodes(input) result(result_)
end function check_num_side_nodes

function check_vb(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -241,7 +230,6 @@ function check_vb(input) result(result_)
end function check_vb

function check_vb1(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -254,7 +242,6 @@ function check_vb1(input) result(result_)
end function check_vb1

function check_coordinates(input) result(result_)
implicit none
class(input_t), intent(in) :: input
type(result_t) :: result_

Expand All @@ -274,7 +261,6 @@ end function check_coordinates
!! Constructors
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function data_file_state_constructor() result(data_file_state)
implicit none
type(data_file_state_t) :: data_file_state

integer, parameter :: file_io = 200
Expand Down