Skip to content

Commit

Permalink
pre-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Fuest committed Sep 18, 2024
1 parent f08f68f commit 31a6431
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
repos:
- 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

- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- flake8-isort
args: [--max-line-length=88]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ['--profile=black']
files: \.py$

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
language_version: python3.8

- repo: https://github.com/pycqa/autoflake
rev: v1.6.0
hooks:
- id: autoflake
name: autoflake (remove unused imports and variables)
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variables']
types: [python]
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ test: ## run tests quickly with the default Python
python -m pytest --cov=endata --cov-report xml

.PHONY: lint
lint: ## check style with flake8 and isort
flake8 endata tests
isort -c --recursive endata tests
lint: ## check style with pre-commit hooks
pre-commit run --all-files

.PHONY: install-develop
install-develop: clean-build clean-pyc ## install the package in editable mode and dependencies for development
Expand All @@ -55,10 +54,8 @@ test-all: ## run tests on every Python version with tox
tox -r -p auto

.PHONY: fix-lint
fix-lint: ## fix lint issues using autoflake, autopep8, and isort
find endata tests -name '*.py' | xargs autoflake --in-place --remove-all-unused-imports --remove-unused-variables
autopep8 --in-place --recursive --aggressive endata tests
isort --apply --atomic --recursive endata tests
fix-lint: ## fix lint issues using pre-commit hooks
pre-commit run --all-files

.PHONY: coverage
coverage: ## check code coverage quickly with the default Python
Expand Down

0 comments on commit 31a6431

Please sign in to comment.