Skip to content

Commit

Permalink
chore: replace .githooks with Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
tmzane committed Mar 28, 2024
1 parent b1bd678 commit 994e2e6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
19 changes: 0 additions & 19 deletions .githooks/pre-commit

This file was deleted.

24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.POSIX:
.SUFFIXES:

all: fmt test lint

fmt:
ruff format

test:
python3 -m unittest -v

lint:
ruff check

mypy:
mypy .

# run `make pre-commit` once to install the hook.
pre-commit: .git/hooks/pre-commit fmt test lint mypy
git diff --exit-code

.git/hooks/pre-commit:
echo "make pre-commit" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
3 changes: 1 addition & 2 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class Writer(typing.Protocol):
Anything that supports write.
"""

def write(self, _: str, /) -> int:
...
def write(self, _: str, /) -> int: ...


def print_menu_item(text: str, *, out: Writer = sys.stdout, **params: typing.Unpack[Params]) -> None:
Expand Down
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
strict = true
pretty = true

[tool.black]
check = true
diff = true
color = true
line-length = 120

[tool.ruff]
line-length = 999

[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
]
line-length = 120
File renamed without changes.

0 comments on commit 994e2e6

Please sign in to comment.