summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/checks.yml45
-rw-r--r--.pre-commit-config.yaml24
-rw-r--r--setup.cfg15
3 files changed, 84 insertions, 0 deletions
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
new file mode 100644
index 0000000..f0753ac
--- /dev/null
+++ b/.github/workflows/checks.yml
@@ -0,0 +1,45 @@
+name: checks
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ mypy:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python: [3.6, 3.7, 3.8]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v1
+
+ - name: Set up Python
+ uses: actions/setup-python@v1
+
+ - name: Install mypy
+ run: |
+ pip install --upgrade pip
+ pip install mypy
+ mypy --version
+
+ - name: Run mypy
+ run: mypy --python-version ${{ matrix.python }} -p ioctl
+
+
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup Python
+ uses: actions/setup-python@v2
+
+ - name: Run pre-commit
+ uses: pre-commit/action@v2.0.0
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..f74ea65
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,24 @@
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.1.0
+ hooks:
+ - id: check-ast
+ - id: check-builtin-literals
+ - id: check-docstring-first
+ - id: check-merge-conflict
+ - id: check-yaml
+ - id: check-toml
+ - id: debug-statements
+ - id: double-quote-string-fixer
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+- repo: https://github.com/pre-commit/mirrors-isort
+ rev: master
+ hooks:
+ - id: isort
+- repo: https://gitlab.com/pycqa/flake8
+ rev: 3.8.3
+ hooks:
+ - id: flake8
+ additional_dependencies: ['flake8-bugbear']
+ language_version: python3.6
diff --git a/setup.cfg b/setup.cfg
index 6b9ea38..8e18434 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -17,3 +17,18 @@ url = https://github.com/FFY00/python-ioctl
[options]
packages = find:
python_requires = >=3.6, <4
+
+[flake8]
+max-line-length = 127
+max-complexity = 10
+
+[mypy]
+ignore_missing_imports = True
+strict = True
+
+[isort]
+line_length = 127
+lines_between_types = 1
+lines_after_imports = 2
+known_first_party = ioctl
+default_section = THIRDPARTY