Browse Source

added pre-commit hook running linter & tests

Fabian Peter Hammerle 4 years ago
parent
commit
cbb98e07a9
4 changed files with 32 additions and 5 deletions
  1. 9 0
      .githooks/pre-commit
  2. 2 0
      Pipfile
  3. 18 1
      Pipfile.lock
  4. 3 4
      README.md

+ 9 - 0
.githooks/pre-commit

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -ex
+
+pipenv clean
+pipenv sync --dev
+pipenv run black --check
+pipenv run pylint yamily
+pipenv run pytest --cov=yamily --cov-report=term-missing --cov-fail-under=100

+ 2 - 0
Pipfile

@@ -4,6 +4,8 @@ verify_ssl = true
 name = "pypi"
 
 [dev-packages]
+# workaround for pipenv ignoring extras
+PyYAML = "*"
 black = "==19.10b0"
 pylint = "*"
 pytest = "*"

+ 18 - 1
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "b1b86d9ae18aca0a1339845085459a79eed349f29c7f644e10ea1c84ed183fc9"
+            "sha256": "1aa10cf2b1025b851ea8a8bed6a9d3cc979995a8019419ec57b7af3165404887"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -203,6 +203,23 @@
             "index": "pypi",
             "version": "==2.8.1"
         },
+        "pyyaml": {
+            "hashes": [
+                "sha256:0e7f69397d53155e55d10ff68fdfb2cf630a35e6daf65cf0bdeaf04f127c09dc",
+                "sha256:2e9f0b7c5914367b0916c3c104a024bb68f269a486b9d04a2e8ac6f6597b7803",
+                "sha256:35ace9b4147848cafac3db142795ee42deebe9d0dad885ce643928e88daebdcc",
+                "sha256:38a4f0d114101c58c0f3a88aeaa44d63efd588845c5a2df5290b73db8f246d15",
+                "sha256:483eb6a33b671408c8529106df3707270bfacb2447bf8ad856a4b4f57f6e3075",
+                "sha256:4b6be5edb9f6bb73680f5bf4ee08ff25416d1400fbd4535fe0069b2994da07cd",
+                "sha256:7f38e35c00e160db592091751d385cd7b3046d6d51f578b29943225178257b31",
+                "sha256:8100c896ecb361794d8bfdb9c11fce618c7cf83d624d73d5ab38aef3bc82d43f",
+                "sha256:c0ee8eca2c582d29c3c2ec6e2c4f703d1b7f1fb10bc72317355a746057e7346c",
+                "sha256:e4c015484ff0ff197564917b4b4246ca03f411b9bd7f16e02a2f586eb48b6d04",
+                "sha256:ebc4ed52dcc93eeebeae5cf5deb2ae4347b3a81c3fa12b0b8c976544829396a4"
+            ],
+            "index": "pypi",
+            "version": "==5.2"
+        },
         "regex": {
             "hashes": [
                 "sha256:032fdcc03406e1a6485ec09b826eac78732943840c4b29e503b789716f051d8d",

+ 3 - 4
README.md

@@ -5,7 +5,8 @@ Define family trees in YAML
 ## setup
 
 ```sh
-sudo apt-get install python3-yaml
+$ sudo apt-get install python3-yaml # optional on debian
+$ pip3 install --user --upgrade yamily
 ```
 
 ## develop
@@ -13,7 +14,5 @@ sudo apt-get install python3-yaml
 ```sh
 $ git clone git@git.hammerle.me:fphammerle/yamily.git
 $ cd yamily
-$ pipenv sync --dev
-$ pipenv run pylint yamily
-$ pipenv run pytest --cov=yamily --cov-report=term-missing --cov-fail-under=100
+$ git config --local core.hooksPath .githooks/
 ```