Skip to content

Commit

Permalink
Merge pull request #1 from btschwertfeger/dev
Browse files Browse the repository at this point in the history
Added pre-commit workflow to standardize the code base
  • Loading branch information
btschwertfeger authored Mar 14, 2023
2 parents d941f19 + 9a90fe1 commit f21ae59
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 117 deletions.
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

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

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
os: [ubuntu-latest] #, macos-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.11"]

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
category: "/language:${{ matrix.language }}"
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pre-Commit

on:
push:
branches: ["*", "!master"]
pull_request:
branches: ["*"]

concurrency:
group: pre-commit-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
name: Pre-Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pre-commit/[email protected]
11 changes: 10 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
name: Pre-Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pre-commit/[email protected]

build:
needs: [pre-commit]
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ del*.py
*.zip

*.egg-info/
conda.stuff/
conda.stuff/
59 changes: 40 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
# all available hooks can be found here: https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml
- id: check-yaml
- id: check-ast
- id: check-docstring-first
- id: check-case-conflict
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=500"]
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: fix-encoding-pragma
- id: requirements-txt-fixer
- id: end-of-file-fixer
- id: check-executables-have-shebangs
- id: detect-private-key
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"] # solves conflicts between black and isort
- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: flake8
# exclude: ^examples/
# additional_dependencies: [flake8-docstrings]
- id: isort
args: ["--profile", "black"] # solves conflicts between black and isort
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--select=E9,F63,F7,F82", "--show-source", "--statistics"]
- repo: https://github.com/pycqa/pylint
rev: v2.17.0
hooks:
- id: pylint
name: pylint
types: [python]
exclude: ^examples/|^tests/|^setup.py$
args: ["--rcfile=.pylintrc"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
9 changes: 6 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ min-public-methods=2
[EXCEPTIONS]

# Exceptions that will emit a warning when caught.
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtin.BaseException,
builtin.Exception


[FORMAT]
Expand Down Expand Up @@ -423,7 +423,10 @@ disable=raw-checker-failed,
use-symbolic-message-instead,
anomalous-backslash-in-string,
multiple-statements,
line-too-long
line-too-long,
import-error,
consider-using-with


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

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


### 📍 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.
### 📍 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.

---

Expand Down
4 changes: 2 additions & 2 deletions cmethods/CMethods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfegerr
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# Github: https://github.com/btschwertfeger
#

Expand Down
4 changes: 2 additions & 2 deletions cmethods/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfegerr
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# Github: https://github.com/btschwertfeger
#
Loading

0 comments on commit f21ae59

Please sign in to comment.