Skip to content

Commit

Permalink
Create pre-commit and pre-push hooks for lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
indrajithi committed Jun 16, 2024
1 parent 16a5af4 commit 02c5243
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
# - repo: https://github.com/pycqa/pylint
# rev: pylint-3.0.2
# hooks:
# - id: pylint
# args:
# - --max-line-length=80
# - --ignore-imports=yes
# - -d duplicate-code
- repo: local
hooks:
- id: pylint
name: Run pylint
entry: poetry run pylint
language: system
types: [python]
args: ["tiny_web_crawler"]
stages: [commit]
- id: pytest
name: Run pytest
entry: poetry run pytest
language: system
types: [python]
stages: [push]
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ homepage = "http://github.com/indrajithi/tiny-web-crawler"
repository = "http://github.com/indrajithi/tiny-web-crawler"
documentation = "http://github.com/indrajithi/tiny-web-crawler"


[tool.poetry.scripts]
post_install = "scripts:post_install"

[tool.poetry.dependencies]
python = "^3.8"
validators = "^0.28.3"
Expand Down
4 changes: 4 additions & 0 deletions script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import subprocess

def post_install() -> None:
subprocess.run(["poetry", "run", "pre-commit", "install"], check=True)

0 comments on commit 02c5243

Please sign in to comment.