Skip to content

Commit f21ae59

Browse files
Merge pull request #1 from btschwertfeger/dev
Added pre-commit workflow to standardize the code base
2 parents d941f19 + 9a90fe1 commit f21ae59

19 files changed

+211
-117
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
3031

3132
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
3638

3739
**Additional context**
3840
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
max-parallel: 1
2222
matrix:
23-
os: [ubuntu-latest] #, macos-latest, windows-latest]
23+
os: [ubuntu-latest]
2424
python-version: ["3.11"]
2525

2626
env:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ jobs:
7474
- name: Perform CodeQL Analysis
7575
uses: github/codeql-action/analyze@v2
7676
with:
77-
category: "/language:${{matrix.language}}"
77+
category: "/language:${{ matrix.language }}"

.github/workflows/pre-commit.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pre-Commit
2+
3+
on:
4+
push:
5+
branches: ["*", "!master"]
6+
pull_request:
7+
branches: ["*"]
8+
9+
concurrency:
10+
group: pre-commit-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
pre-commit:
15+
name: Pre-Commit
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
- uses: pre-commit/[email protected]

.github/workflows/python-package.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
pre-commit:
18+
name: Pre-Commit
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- uses: pre-commit/[email protected]
24+
1725
build:
26+
needs: [pre-commit]
27+
name: Build
1828
runs-on: ubuntu-latest
1929
strategy:
2030
fail-fast: false
2131
matrix:
2232
python-version: ["3.8", "3.9", "3.10", "3.11"]
23-
2433
steps:
2534
- uses: actions/checkout@v3
2635
- name: Set up Python ${{ matrix.python-version }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@ del*.py
136136
*.zip
137137

138138
*.egg-info/
139-
conda.stuff/
139+
conda.stuff/

.pre-commit-config.yaml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
44
hooks:
5-
- id: check-yaml
6-
- id: end-of-file-fixer
7-
- id: trailing-whitespace
8-
- id: check-added-large-files
9-
- repo: https://github.com/psf/black
10-
rev: 22.10.0
5+
# all available hooks can be found here: https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml
6+
- id: check-yaml
7+
- id: check-ast
8+
- id: check-docstring-first
9+
- id: check-case-conflict
10+
- id: check-merge-conflict
11+
- id: check-added-large-files
12+
args: ["--maxkb=500"]
13+
- id: trailing-whitespace
14+
- id: fix-byte-order-marker
15+
- id: fix-encoding-pragma
16+
- id: requirements-txt-fixer
17+
- id: end-of-file-fixer
18+
- id: check-executables-have-shebangs
19+
- id: detect-private-key
20+
- repo: https://github.com/psf/black
21+
rev: 23.1.0
1122
hooks:
12-
- id: black
13-
- repo: https://github.com/PyCQA/isort
14-
rev: 5.12.0
15-
hooks:
16-
- id: isort
17-
args: ["--profile", "black"] # solves conflicts between black and isort
18-
- repo: https://github.com/pycqa/flake8
19-
rev: '6.0.0'
23+
- id: black
24+
- repo: https://github.com/PyCQA/isort
25+
rev: 5.12.0
2026
hooks:
21-
- id: flake8
22-
# exclude: ^examples/
23-
# additional_dependencies: [flake8-docstrings]
27+
- id: isort
28+
args: ["--profile", "black"] # solves conflicts between black and isort
29+
- repo: https://github.com/pycqa/flake8
30+
rev: 6.0.0
31+
hooks:
32+
- id: flake8
2433
args: ["--select=E9,F63,F7,F82", "--show-source", "--statistics"]
34+
- repo: https://github.com/pycqa/pylint
35+
rev: v2.17.0
36+
hooks:
37+
- id: pylint
38+
name: pylint
39+
types: [python]
40+
exclude: ^examples/|^tests/|^setup.py$
41+
args: ["--rcfile=.pylintrc"]
42+
- repo: https://github.com/pre-commit/mirrors-prettier
43+
rev: v2.7.1
44+
hooks:
45+
- id: prettier

.pylintrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ min-public-methods=2
312312
[EXCEPTIONS]
313313

314314
# Exceptions that will emit a warning when caught.
315-
overgeneral-exceptions=BaseException,
316-
Exception
315+
overgeneral-exceptions=builtin.BaseException,
316+
builtin.Exception
317317

318318

319319
[FORMAT]
@@ -423,7 +423,10 @@ disable=raw-checker-failed,
423423
use-symbolic-message-instead,
424424
anomalous-backslash-in-string,
425425
multiple-statements,
426-
line-too-long
426+
line-too-long,
427+
import-error,
428+
consider-using-with
429+
427430

428431
# Enable the message, report, category or checker with the given id(s). You can
429432
# either give multiple identifier separated by comma (,) or put this option

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
This Python module contains a collection of different scale- and distribution-based bias adjustment techniques for climatic research (see `/examples/examples.ipynb` for help).
1919

20-
21-
### 📍 For the application of bias corrections on *lage data sets* it is recomanded to use the C++ tool [BiasAdjustCXX](https://github.com/btschwertfeger/Bias-Adjustment-Cpp) since bias corrections are complex statistical transformation which are very slow in Python compared to the C++ implementation.
20+
### 📍 For the application of bias corrections on _lage data sets_ it is recomanded to use the C++ tool [BiasAdjustCXX](https://github.com/btschwertfeger/Bias-Adjustment-Cpp) since bias corrections are complex statistical transformation which are very slow in Python compared to the C++ implementation.
2221

2322
---
2423

0 commit comments

Comments
 (0)