diff --git a/.gitignore b/.gitignore index d342869..7f1a277 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ build/ build-cmake/ *Temporary .vscode -*.egg-info \ No newline at end of file +*.egg-info +.venv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9e5a25..0c71b46 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/README.md b/README.md index dad3cee..549d23b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/formatting/README.md b/formatting/README.md index 8aa4970..fa87352 100644 --- a/formatting/README.md +++ b/formatting/README.md @@ -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. | | diff --git a/formatting/fortitude.toml b/formatting/fortitude.toml deleted file mode 100644 index 5322969..0000000 --- a/formatting/fortitude.toml +++ /dev/null @@ -1,5 +0,0 @@ -[check] -ignore = [ - "C003", # 'implicit none' missing 'external' -] -line-length = 132 diff --git a/formatting/fortitude.md b/formatting/fortitude/README.md similarity index 75% rename from formatting/fortitude.md rename to formatting/fortitude/README.md index ef1039a..70b6a48 100644 --- a/formatting/fortitude.md +++ b/formatting/fortitude/README.md @@ -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 @@ -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 diff --git a/formatting/fortitude/fortitude.toml b/formatting/fortitude/fortitude.toml new file mode 100644 index 0000000..31b317a --- /dev/null +++ b/formatting/fortitude/fortitude.toml @@ -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 +# behaviour of rule S001 (line-too-long) +line-length = 132 diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index b7056c4..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,14 +0,0 @@ -[build-system] -build-backend = "setuptools.build_meta" -requires = [ - "setuptools", - "setuptools-scm", -] - -[project] -name = "fortran-tooling" -version = "0.0.1" -dependencies = [ - "fortitude-lint>=0.7.2", - "pre-commit>=4.2.0" -] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8b9a709 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fortitude-lint>=0.7.2 +pre-commit>=4.2.0 diff --git a/testing/veggies/test_poisson_given_when_then.f90 b/testing/veggies/test_poisson_given_when_then.f90 index ecb16c2..0c97c61 100644 --- a/testing/veggies/test_poisson_given_when_then.f90 +++ b/testing/veggies/test_poisson_given_when_then.f90 @@ -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 @@ -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 @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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_ @@ -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