瀏覽代碼

add pre-commit

Joao Andre 3 年之前
父節點
當前提交
968f155bf3
共有 2 個文件被更改,包括 52 次插入0 次删除
  1. 10 0
      .license-header
  2. 42 0
      .pre-commit-config.yaml

+ 10 - 0
.license-header

@@ -0,0 +1,10 @@
+Copyright 2022 Avaiga Private Limited
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.

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

@@ -0,0 +1,42 @@
+repos:
+-   repo: https://github.com/pre-commit/mirrors-mypy
+    rev: 'v0.910'  # Use the sha / tag you want to point at
+    hooks:
+    -   id: mypy
+        additional_dependencies: [
+                'types-Markdown',
+                'types-python-dateutil',
+                'types-pytz',
+                'types-tzlocal',
+        ]
+-   repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.1.10
+    hooks:
+    -   id: forbid-crlf
+    -   id: remove-crlf
+    -   id: forbid-tabs
+    -   id: remove-tabs
+    -   id: insert-license
+        files: \.py$
+        args:
+        - --license-filepath
+        - .license-header
+-   repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.0.1
+    hooks:
+    - id: trailing-whitespace
+    - id: end-of-file-fixer
+    - id: check-merge-conflict
+    - id: check-yaml
+      args: [--unsafe]
+-   repo: https://github.com/ambv/black
+    rev: 21.8b0
+    hooks:
+    - id: black
+      args: [--line-length=120]
+      language_version: python3.9
+-   repo: https://gitlab.com/pycqa/flake8
+    rev: 3.9.2
+    hooks:
+    -   id: flake8
+        additional_dependencies: [flake8-typing-imports==1.10.0]