Skip to content
Snippets Groups Projects
Commit c1c0e142 authored by Timo Koch's avatar Timo Koch
Browse files

[python][ci] Run black linter in the CI (only passes if no black would not change anything)

parent ab4a0a4c
No related branches found
No related tags found
1 merge request!2681Feature/python main file
...@@ -3,6 +3,7 @@ default: ...@@ -3,6 +3,7 @@ default:
stages: stages:
- linting
- configure - configure
- select - select
- build - build
...@@ -30,6 +31,14 @@ configure: ...@@ -30,6 +31,14 @@ configure:
- build-cmake - build-cmake
expire_in: 3 hours expire_in: 3 hours
python linting:
stage: linting
image: registry.gitlab.com/pipeline-components/black:latest
script:
# only check the python folder for now (Python code related to bindings)
# TODO: maybe extend this to the utility scripts?
- black --check --verbose -- python
select tests: select tests:
stage: select stage: select
......
...@@ -69,3 +69,14 @@ You can run all currently existing DuMu<sup>x</sup> Python tests with ...@@ -69,3 +69,14 @@ You can run all currently existing DuMu<sup>x</sup> Python tests with
cd dumux/build-cmake cd dumux/build-cmake
ctest -L python ctest -L python
``` ```
## Development
All Python files should be linted by the tool [`black`](https://pypi.org/project/black/).
You can install `black` with `pip install black` and run it from the dumux top-directory
```
black ./python
```
You can also run it on a specific file (replace `./python` by file name)
This will automatically format the Python files. Run black before every commit changing Python files.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment