Skip to content

Commit d0762d4

Browse files
Makes Precommit Manager Independent
Changes the local pre-commit hooks out for remote ones, as well as changes the action to use the pre-commit action, so pre-commit will no longer depend on your project manager's settings.
1 parent 6563dbb commit d0762d4

2 files changed

Lines changed: 17 additions & 58 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,5 @@ jobs:
3131
with:
3232
python-version: ${{ env.PYTHON_VERSION }}
3333

34-
# This step caches our Python dependencies. To make sure we
35-
# only restore a cache when the dependencies, the python version and
36-
# the runner operating system we create a cache key
37-
# that is a composite of those states.
38-
# Only when the context is exactly the same, we will restore the cache.
39-
- name: Restore pip cache
40-
uses: actions/cache@v2
41-
with:
42-
path: ${{ env.PIP_CACHE_DIR }}
43-
key: "python-pip-${{ runner.os }}-\
44-
${{ steps.python.outputs.python-version }}-\
45-
${{ hashFiles('./Pipfile', './Pipfile.lock') }}"
46-
47-
# Uncomment the step that matches your setup.
48-
49-
# Default Env setup
50-
- name: Run hooks through our requirement file
51-
run: |
52-
pip install -r dev-requirements.txt
53-
pre-commit run --all-files
54-
env:
55-
# Force pre-commit to do a system install.
56-
PIP_USER: 0
57-
58-
# Pipenv setup
59-
# - name: Run hooks through our Pipenv environment.
60-
# run: |
61-
# pipenv install --system --dev
62-
# pipenv run python -m pre-commit run --all-files
63-
# env:
64-
# # Force pre-commit to do a system install.
65-
# PIP_USER: 0
66-
67-
# Poetry setup
68-
# - name: Run hooks through our Poetry environment.
69-
# run: |
70-
# poetry install
71-
# poetry run python -m pre-commit run --all-files
72-
# env:
73-
# # Force pre-commit to do a system install.
74-
# PIP_USER: 0
34+
- name: Run pre-commit hooks.
35+
uses: pre-commit/action@v2.0.3

.pre-commit-config.yaml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Pre-commit setup
22
# See https://github.com/python-discord/code-jam-template/tree/main#pre-commit-run-linting-before-committing
3-
#
4-
# Please uncomment the right lines depending on your setup.
3+
4+
# Make sure to edit the `additional_dependencies` list if you want to add plugins
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -12,25 +12,23 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
args: [--markdown-linebreak-ext=md]
15+
1516
- repo: https://github.com/pre-commit/pygrep-hooks
1617
rev: v1.5.1
1718
hooks:
1819
- id: python-check-blanket-noqa
19-
- repo: local
20+
21+
- repo: https://github.com/pre-commit/mirrors-isort
22+
rev: v5.9.2
2023
hooks:
2124
- id: isort
22-
name: ISort
23-
entry: python -m isort . # Default Env setup
24-
# entry: pipenv run python -m isort . # Pipenv setup
25-
# entry: poetry run python -m isort . # Poetry setup
26-
language: system
27-
types: [python]
28-
require_serial: true
25+
26+
- repo: https://github.com/pycqa/flake8
27+
rev: 3.9.2
28+
hooks:
2929
- id: flake8
30-
name: Flake8
31-
entry: python -m flake8 # Default Env setup
32-
# entry: pipenv run python -m flake8 # Pipenv setup
33-
# entry: poetry run python -m flake8 # Poetry setup
34-
language: system
35-
types: [python]
36-
require_serial: true
30+
additional_dependencies:
31+
- flake8-annotations~=2.0
32+
- flake8-bandit~=2.1
33+
- flake8-docstrings~=1.5
34+
- flake8-isort~=4.0

0 commit comments

Comments
 (0)