Pārlūkot izejas kodu

introduce pre-commit

* use black as a way of unify the codestyle of the project
* use flake8 as a way to identify problems with the code
Victor Seva 5 gadi atpakaļ
vecāks
revīzija
fc678a485c
5 mainītis faili ar 30 papildinājumiem un 2 dzēšanām
  1. 5 0
      .flake8
  2. 9 0
      .pre-commit-config.yaml
  3. 5 2
      docs/Devel.md
  4. 10 0
      pyproject.toml
  5. 1 0
      requirements_dev.txt

+ 5 - 0
.flake8

@@ -0,0 +1,5 @@
+[flake8]
+ignore = E203, E231, E266, E501, W503, F403, F401
+max-line-length = 79
+max-complexity = 18
+select = B,C,E,F,W,T4,B9

+ 9 - 0
.pre-commit-config.yaml

@@ -0,0 +1,9 @@
+repos:
+-   repo: https://github.com/psf/black
+    rev: stable
+    hooks:
+    -   id: black
+-   repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v2.3.0
+    hooks:
+    -   id: flake8

+ 5 - 2
docs/Devel.md

@@ -5,9 +5,12 @@ Kamailio Command Line Interface Control Tool
 
 ### Development Guidelines
 
-#### Indentation
+#### [pre-commit](https://pre-commit.com/)
 
-  * user 4 whitespaces (no tabs) for indentation
+  * apt install build-essentials python3-dev python3-virtualenvwrapper
+  * mkvirtualenv kamcli --python=python3
+  * pip install -r requirements_dev.txt
+  * pre-commit install
 
 #### Used Frameworks
 

+ 10 - 0
pyproject.toml

@@ -0,0 +1,10 @@
+[tool.black]
+target-version = ['py37']
+line-length = 79
+include = '\.pyi?$'
+exclude = '''
+/(
+    \.git
+  | \.tox
+)/
+'''

+ 1 - 0
requirements_dev.txt

@@ -0,0 +1 @@
+pre-commit