Skip to content

Commit d718e2f

Browse files
Chore: Update linting configuration from osc-github-devops
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
1 parent 7cd4a2f commit d718e2f

14 files changed

Lines changed: 2300 additions & 3489 deletions

.github/workflows/release.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ on:
1010
push:
1111
# Only invoked on release tag pushes
1212
branches:
13-
- 'main'
14-
- 'master'
13+
- "main"
14+
- "master"
1515
tags:
16-
- 'v*.*.*'
16+
- "v*.*.*"
1717

1818
env:
1919
python-version: "3.10"
2020

2121
### BUILD ###
2222

2323
jobs:
24-
2524
build:
2625
name: "🐍 Build packages"
2726
# Only publish on tag pushes

.github/workflows/security.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
- "!update-devops-tooling"
1717

1818
jobs:
19-
2019
parse-project-metadata:
2120
name: "Determine Python versions"
2221
# yamllint disable-line rule:line-length

.github/workflows/testing.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
- "!update-devops-tooling"
1212

1313
jobs:
14-
1514
parse-project-metadata:
1615
name: "Determine Python versions"
1716
# yamllint disable-line rule:line-length

.pre-commit-config.yaml

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,76 @@
11
---
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-FileCopyrightText: 2024 The Linux Foundation
4+
25
ci:
3-
autofix_commit_msg: "Chore: pre-commit autoupdate"
4-
skip:
5-
# pre-commit.ci cannot install WGET, so tomlint must be disabled
6-
- tomllint
6+
autofix_commit_msg: "Chore: pre-commit.ci automated update"
77

88
exclude: |
9-
(?x)^(
10-
docs\/conf.py|
11-
dco-signoffs/$
12-
)$
9+
(?x)(
10+
^docs\/conf.py|
11+
^dco-signoffs/|
12+
^tests/resources
13+
)
1314
1415
repos:
15-
16-
- repo: local
17-
hooks:
18-
- id: tomllint
19-
name: "Script: scripts/tomllint.sh"
20-
language: script
21-
# pass_filenames: false
22-
files: \^*.toml
23-
types: [file]
24-
entry: scripts/tomllint.sh .
25-
2616
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v4.6.0
17+
rev: v5.0.0
2818
hooks:
2919
- id: check-added-large-files
20+
- id: check-ast
21+
- id: check-builtin-literals
3022
- id: check-case-conflict
23+
- id: check-docstring-first
3124
- id: check-executables-have-shebangs
25+
- id: check-illegal-windows-names
3226
- id: check-json
3327
- id: check-merge-conflict
3428
- id: check-shebang-scripts-are-executable
3529
- id: check-symlinks
3630
- id: check-toml
37-
# - id: detect-aws-credentials
31+
- id: check-vcs-permalinks
3832
- id: check-xml
3933
- id: check-yaml
4034
- id: debug-statements
35+
- id: destroyed-symlinks
36+
- id: detect-aws-credentials
37+
args: ["--allow-missing-credentials"]
38+
# - id: double-quote-string-fixer
4139
- id: detect-private-key
4240
- id: end-of-file-fixer
41+
- id: file-contents-sorter
42+
- id: fix-byte-order-marker
43+
- id: forbid-new-submodules
44+
- id: forbid-submodules
4345
- id: mixed-line-ending
4446
args: ["--fix=lf"]
4547
- id: name-tests-test
4648
args: ["--pytest-test-first"]
4749
- id: no-commit-to-branch
4850
# - id: pretty-format-json
4951
- id: requirements-txt-fixer
52+
- id: sort-simple-yaml
53+
# Without specifying files, the above is inactive
54+
# files: ^config/simple/
5055
- id: trailing-whitespace
5156

52-
# yamllint disable rule:comments-indentation
53-
## Commenting until issue #94 is fixed
54-
# - repo: https://github.com/igorshubovych/markdownlint-cli
55-
# rev: v0.41.0
56-
# hooks:
57-
# - id: markdownlint
58-
# args: ["--fix"]
59-
# yamllint enable rule:comments-indentation
57+
- repo: https://github.com/pre-commit/mirrors-prettier
58+
rev: v4.0.0-alpha.8
59+
hooks:
60+
- id: prettier
61+
args: ["--no-error-on-unmatched-pattern", "--ignore-unknown"]
62+
63+
- repo: https://github.com/igorshubovych/markdownlint-cli
64+
rev: v0.44.0
65+
hooks:
66+
- id: markdownlint
67+
args: ["--fix"]
6068

6169
- repo: https://github.com/jorisroovers/gitlint
6270
rev: v0.19.1
6371
hooks:
6472
- id: gitlint
73+
args: ["-c body-max-line-length=120", "-c title-max-length=120"]
6574

6675
- repo: https://github.com/openstack/bashate
6776
rev: 2.1.1
@@ -73,36 +82,67 @@ repos:
7382
rev: v0.10.0.1
7483
hooks:
7584
- id: shellcheck
85+
args: ["-x"] # Check external files
7686

7787
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
78-
rev: v1.7.1.15
88+
rev: v1.7.7.23
7989
hooks:
8090
- id: actionlint
8191

8292
- repo: https://github.com/adrienverge/yamllint.git
8393
rev: v1.35.1
8494
hooks:
8595
- id: yamllint
96+
types: [yaml]
8697
args:
87-
["-d", "{rules: {line-length: {max: 120}},
88-
ignore-from-file: [.gitignore],}"]
98+
[
99+
"-d",
100+
"{rules: {line-length: {max: 100}}, ignore-from-file: [.gitignore],}",
101+
]
89102

90103
- repo: https://github.com/astral-sh/ruff-pre-commit
91-
rev: v0.6.1
104+
rev: v0.9.9
92105
hooks:
93106
- id: ruff
94107
args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml]
95108
- id: ruff-format
96109

110+
# Enable to check for explicit SPDX strings in every file
111+
# - repo: https://github.com/fsfe/reuse-tool
112+
# rev: v5.0.2
113+
# hooks:
114+
# - id: reuse
115+
116+
- repo: local
117+
hooks:
118+
- id: mypy-cache
119+
name: "create mypy cache"
120+
language: system
121+
pass_filenames: false
122+
entry: bash -c 'if [ ! -d .mypy_cache ]; then /bin/mkdir .mypy_cache; fi; exit 0'
123+
124+
- repo: https://github.com/abravalheri/validate-pyproject
125+
rev: v0.23
126+
hooks:
127+
- id: validate-pyproject
128+
# Optional extra validations from SchemaStore:
129+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
130+
97131
- repo: https://github.com/pre-commit/mirrors-mypy
98-
rev: "v1.11.1"
132+
rev: "v1.15.0"
99133
hooks:
100134
- id: mypy
101135
verbose: true
102136
args: ["--show-error-codes", "--install-types", "--non-interactive"]
103137
additional_dependencies: ["pytest", "types-requests"]
104138

105-
# yamllint disable rule:comments-indentation
139+
# Extremely pedantic checker of grammar and passive tense in docs
140+
# - repo: https://github.com/btford/write-good
141+
# rev: ab66ce10136dfad5146e69e70f82a3efac8842c1 # frozen: v1.0.8
142+
# hooks:
143+
# - id: write-good
144+
# files: "\\.(rst|md|markdown|mdown|mkdn)$"
145+
106146
# Check for misspellings in documentation files
107147
# - repo: https://github.com/codespell-project/codespell
108148
# rev: v2.2.2
@@ -115,4 +155,3 @@ repos:
115155
# hooks:
116156
# - id: pyupgrade
117157
# args: ['--py37-plus']
118-
# yamllint enable rule:comments-indentation

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Copy `hazard_workflow_input_example.yml`, rename to `hazard_workflow_input.yml`,
7474
You can then invoke the CWL with:
7575

7676
```
77-
$ cwltool hazard_workflow.cwl#produce-hazard-indicator hazard_workflow_input.yml
77+
cwltool hazard_workflow.cwl#produce-hazard-indicator hazard_workflow_input.yml
7878
```
7979

8080
If successful, you'll find indicators generated in `indicators/` in the repo root.

hazard_workflow_input_example.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
write_xarray_compatible_zarr: false # type 'boolean'
2-
window_years: 0 # type 'int'
3-
threshold_temperature: 0.1 # type 'float'
4-
threshold_list: "[]" # default value of type 'string'.
5-
store: "./indicator" # default value of type 'string'.
6-
source_dataset_kwargs: "{}" # default value of type 'string'.
7-
source_dataset: a_string # type 'string'
8-
scenario_list: a_string # type 'string'
9-
indicator: "days_tas_above_indicator" # default value of type 'string'.
10-
gcm_list: a_string # type 'string'
11-
dask_cluster_kwargs: "{'n_workers': 1, 'threads_per_worker': 1}" # default value of type 'string'.
12-
central_year_list: a_string # type 'string'
13-
central_year_historical: 0 # type 'int'
14-
ceda_ftp_username: a_string # type 'string'
15-
ceda_ftp_url: a_string # type 'string'
16-
ceda_ftp_password: a_string # type 'string'
1+
write_xarray_compatible_zarr: false # type 'boolean'
2+
window_years: 0 # type 'int'
3+
threshold_temperature: 0.1 # type 'float'
4+
threshold_list: "[]" # default value of type 'string'.
5+
store: "./indicator" # default value of type 'string'.
6+
source_dataset_kwargs: "{}" # default value of type 'string'.
7+
source_dataset: a_string # type 'string'
8+
scenario_list: a_string # type 'string'
9+
indicator: "days_tas_above_indicator" # default value of type 'string'.
10+
gcm_list: a_string # type 'string'
11+
dask_cluster_kwargs: "{'n_workers': 1, 'threads_per_worker': 1}" # default value of type 'string'.
12+
central_year_list: a_string # type 'string'
13+
central_year_historical: 0 # type 'int'
14+
ceda_ftp_username: a_string # type 'string'
15+
ceda_ftp_url: a_string # type 'string'
16+
ceda_ftp_password: a_string # type 'string'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Global data set of protection levels for riverine and coastal flood, based on the [FLOPROS database] (https://nhess.copernicus.org/articles/16/1049/2016/). For each of coastal and riverine inundation, the dataset provides for every location a minimum ("min") and maximum ("max") protection, specified as a return period in years; the min and max reflects in uncertainty in the protection level. The return period indicates that the location is protected against flood events with that return period (e.g. 100 years indicates that the location is protected against 1-in-100 year flood events). Finding the equivalent flood depth protection level additionally requires a flood depth indicator data set.
1+
Global data set of protection levels for riverine and coastal flood, based on the [FLOPROS database] (<https://nhess.copernicus.org/articles/16/1049/2016/>). For each of coastal and riverine inundation, the dataset provides for every location a minimum ("min") and maximum ("max") protection, specified as a return period in years; the min and max reflects in uncertainty in the protection level. The return period indicates that the location is protected against flood events with that return period (e.g. 100 years indicates that the location is protected against 1-in-100 year flood events). Finding the equivalent flood depth protection level additionally requires a flood depth indicator data set.

src/hazard/onboard/iris_wind.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Sparks, N., Toumi, R. The Imperial College Storm Model (IRIS) Dataset. *Sci Data* **11**, 424 (2024). <https://doi.org/10.1038/s41597-024-03250-y>
1+
Sparks, N., Toumi, R. The Imperial College Storm Model (IRIS) Dataset. _Sci Data_ **11**, 424 (2024). <https://doi.org/10.1038/s41597-024-03250-y>
22

33
## The Imperial College Storm Model (IRIS) Dataset - Scientific Data
4+
45
Assessing tropical cyclone risk on a global scale given the infrequency of landfalling tropical cyclones and the short period of reliable observations remains a challenge. Synthetic tropical cyclone datasets can help overcome these problems. Here we present a new global dataset created by IRIS, the ImpeRIal college Storm Model. IRIS is novel because, unlike other synthetic TC models, it only simulates the decay from the point of lifetime maximum intensity. This minimises the bias in the dataset. It takes input from 42 years of observed tropical cyclones and creates a 10,000 year synthetic dataset which is then validated against the observations. IRIS captures important statistical characteristics of the observed data. The return periods of the landfall maximum wind speed (1 minute sustained in m/s) are realistic globally. Climate model projections are used to adjust the life-time maximum intensity.
56

6-
***Disclaimer***: There have been many improvements on the dataset. Contact Professor Toumi from the Imperial College London for improved data.
7+
**_Disclaimer_**: There have been many improvements on the dataset. Contact Professor Toumi from the Imperial College London for improved data.

src/hazard/onboard/wisc_european_winter_storm.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
Maximum 10 metre 3 second gust peak wind speed (note 3 second average; by default physrisk wind speeds are 1 minute average) for different return periods, inferred from the Copernicus WISC European storm event set. This allows events and return period maps to be used consistently.
32

4-
https://cds.climate.copernicus.eu/datasets/sis-european-wind-storm-synthetic-events?tab=overview
3+
<https://cds.climate.copernicus.eu/datasets/sis-european-wind-storm-synthetic-events?tab=overview>
54

65
The WISC dataset contains a set of synthetic windstorm events consisting of 22,980 individual
76
storm footprints over Europe. These are a physically realistic set of plausible windstorm

0 commit comments

Comments
 (0)