Skip to content

Commit 23a1630

Browse files
authored
Add pre-commit (#243)
* Add pre-commit and codespell * Format Participant * Fix spelling * Reformat with black * Trim whitespaces * Fix file endings * Add check for GH workflows
1 parent ce57e94 commit 23a1630

File tree

14 files changed

+434
-343
lines changed

14 files changed

+434
-343
lines changed

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
ignore-words-list = precice

.github/workflows/check-pep8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: autopep8
14+
- name: autopep8
1515
id: autopep8
1616
uses: peter-evans/autopep8@v1
1717
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
name: dist
3939
path: dist
4040
- name: Publish package distributions to PyPI
41-
uses: pypa/gh-action-pypi-publish@release/v1
41+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/run-solverdummy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
- name: Run solverdummies
3737
run: |
3838
cd examples/solverdummy/
39-
python3 solverdummy.py precice-config.xml SolverOne & python3 solverdummy.py precice-config.xml SolverTwo
39+
python3 solverdummy.py precice-config.xml SolverOne & python3 solverdummy.py precice-config.xml SolverTwo

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
# Official repo for the clang-format hook
3+
- repo: https://github.com/pre-commit/mirrors-clang-format
4+
rev: 'v20.1.0'
5+
hooks:
6+
- id: clang-format
7+
name: format C/C++
8+
types_or: [c++]
9+
# Official repo for default hooks
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: 'v5.0.0'
12+
hooks:
13+
- id: check-merge-conflict
14+
- id: mixed-line-ending
15+
- id: trailing-whitespace
16+
args: [--markdown-linebreak-ext=md]
17+
- id: end-of-file-fixer
18+
# black repo for python formatting
19+
- repo: https://github.com/ambv/black
20+
rev: 25.1.0
21+
hooks:
22+
- id: black
23+
name: format python
24+
- repo: https://github.com/codespell-project/codespell
25+
rev: v2.4.1
26+
hooks:
27+
- id: codespell
28+
name: check spelling
29+
- repo: https://github.com/python-jsonschema/check-jsonschema
30+
rev: 0.33.2
31+
hooks:
32+
- id: check-github-workflows
33+
args: ["--verbose"]

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ All notable changes to this project will be documented in this file.
8282

8383
## 2.2.0.2
8484

85-
* Improved error messgaes for all assertions. https://github.com/precice/python-bindings/pull/9
85+
* Improved error messages for all assertions. https://github.com/precice/python-bindings/pull/9
8686
* Improve CI w.r.t spack package. https://github.com/precice/python-bindings/pull/89
8787

8888
## 2.2.0.1
@@ -118,7 +118,7 @@ All notable changes to this project will be documented in this file.
118118

119119
## 2.0.0.2
120120

121-
* Improvement of PyPI intergration.
121+
* Improvement of PyPI integration.
122122

123123
## 2.0.0.1
124124

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ If preCICE (the C++ library) was installed in a custom prefix, or only built but
6969
* `LIBRARY_PATH`, `LD_LIBRARY_PATH` to the library location, or `$prefix/lib`
7070
* `CPATH` either to the `src` directory or the `$prefix/include`
7171

72-
The preCICE documentation provides more informaiton on [linking preCICE](https://precice.org/installation-linking.html).
72+
The preCICE documentation provides more information on [linking preCICE](https://precice.org/installation-linking.html).
7373

7474
### Using Spack
7575

cyprecice/Participant.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ cdef extern from "precice/precice.hpp" namespace "precice":
7474
void readData (const string& meshName, const string& dataName, vector[int] vertices, const double relativeReadTime, vector[double]& values) except +
7575

7676
# Just-in-time mapping
77-
77+
7878
void writeAndMapData (const string& meshName, const string& dataName, vector[double] coordinates, vector[double] values) except +
7979

8080
void mapAndReadData (const string& meshName, const string& dataName, vector[double] coordinates, double relativeReadTime, vector[double]& values) except +

cyprecice/cyprecice.pyx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ cdef class Participant:
272272
Returns
273273
-------
274274
tag : bool
275-
Returns True if inital data is required.
275+
Returns True if initial data is required.
276276
277277
Notes
278278
-----
@@ -284,10 +284,10 @@ cdef class Participant:
284284
def requires_writing_checkpoint (self):
285285
"""
286286
Checks if the participant is required to write an iteration checkpoint.
287-
287+
288288
If true, the participant is required to write an iteration checkpoint before
289289
calling advance().
290-
290+
291291
preCICE refuses to proceed if writing a checkpoint is required,
292292
but this method isn't called prior to advance().
293293
@@ -1062,7 +1062,7 @@ cdef class Participant:
10621062
vertex_ids : array_like
10631063
Indices of the vertices.
10641064
gradients : array_like
1065-
Gradient values differentiated in the spacial direction (dx, dy) for 2D space, (dx, dy, dz) for 3D space
1065+
Gradient values differentiated in the spatial direction (dx, dy) for 2D space, (dx, dy, dz) for 3D space
10661066
10671067
Notes
10681068
-----
@@ -1117,7 +1117,7 @@ cdef class Participant:
11171117

11181118
def requires_gradient_data_for(self, mesh_name, data_name):
11191119
"""
1120-
Checks if the given data set requires gradient data. We check if the data object has been intialized with the gradient flag.
1120+
Checks if the given data set requires gradient data. We check if the data object has been initialized with the gradient flag.
11211121
11221122
Parameters
11231123
----------
@@ -1229,7 +1229,7 @@ cdef class Participant:
12291229
def start_profiling_section(self, event_name):
12301230
"""
12311231
Starts a profiling section with the given event name.
1232-
1232+
12331233
Parameters
12341234
----------
12351235
event_name : str
@@ -1239,7 +1239,7 @@ cdef class Participant:
12391239
--------
12401240
Start a profiling section with the event name "EventOne":
12411241
>>> event_name = "EventOne"
1242-
>>> participant.start_profiling_section(event_name)
1242+
>>> participant.start_profiling_section(event_name)
12431243
"""
12441244
self.thisptr.startProfilingSection(convert(event_name))
12451245

docs/ReleaseGuide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ The release of the `python-bindings` repository is made directly from a release
4343
commit 44b715dde4e3194fa69e61045089ca4ec6925fe3 (HEAD -> master, origin/master)
4444
Author: Benjamin Rodenberg <benjamin.rodenberg@in.tum.de>
4545
Date: Wed Oct 20 10:52:41 2021 +0200
46-
46+
4747
post-tag bump
48-
48+
4949
commit d2645cc51f84ad5eda43b9c673400aada8e1505a (tag: v2.3.0.1)
5050
Merge: 2039557 aca2354
5151
Author: Benjamin Rodenberg <benjamin.rodenberg@in.tum.de>
5252
Date: Tue Oct 19 12:57:24 2021 +0200
53-
53+
5454
Merge pull request #132 from precice/python-bindings-v2.3.0.1
55-
55+
5656
Release v2.3.0.1
5757
```
5858

0 commit comments

Comments
 (0)