Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added pre-commit hooks commitlint, black, flake8 #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Java
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
Expand All @@ -36,6 +36,8 @@ jobs:
run: black --check .
- name: Run isort
run: isort --check .
- name: Run commitlint
uses: wagoid/commitlint-github-action@v5
- name: Install package
run: python3 -m build
- name: Run tox
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.5.0
hooks:
- id: commitlint
stages: [commit-msg]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Needs
* Java 17+
* Maven 3.8.1+
* Environment variable **JAVA_HOME** should be set appropriately
* Uses conventional commit. commitlint (use **npm install commitlint**)

# Setup and Testing

Expand All @@ -14,8 +15,8 @@ Needs
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install -e '.[dev]'
pre-commit install
tox
python3 -m build
```

# Check code coverage
Expand All @@ -31,7 +32,7 @@ Needs
```
black .
flake8 .
isort .
isort .
```

# To publish the package to PyPi
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local = [
'isort',
'tox',
'pyyaml',
'pre-commit',
]
tests = [
'coverage>=5.0.3',
Expand Down