Skip to content

Commit

Permalink
Add pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
eclectic-boy committed Feb 4, 2023
1 parent 8f9a18d commit 0998c7d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test
- name: Check all code
run: |
make check_all_code
- name: Run test suite
run: |
make test
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: check-yaml
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.1
hooks:
- id: autoflake
args:
- -i
- -r
- --remove-all-unused-imports
- --expand-star-imports
- --ignore-init-module-imports
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
play:
python main.py
python game/main.py

check_all_code:
pre-commit run -a

test:
python -m unittest
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
parameterized
ipdb
parameterized
pre-commit
2 changes: 1 addition & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from parameterized import parameterized

from game.main import Gesture, GestureSuit, Cell, GameMode, RockPaperScissor
from game.main import Cell, GameMode, Gesture, GestureSuit, RockPaperScissor


def abort_after_timeout(timeout):
Expand Down

0 comments on commit 0998c7d

Please sign in to comment.