Configure pre-commit for project (#346)
This commit is contained in:
parent
bd69862a02
commit
a836fb23bc
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [Ubuntu, MacOS, Windows]
|
os: [Ubuntu, MacOS, Windows]
|
||||||
python-version: ['3.6.7', '3.7', '3.8', '3.9', '3.10']
|
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
|
||||||
exclude:
|
exclude:
|
||||||
- os: Windows
|
- os: Windows
|
||||||
python-version: 3.6
|
python-version: 3.6
|
||||||
@ -57,7 +57,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: poetry install
|
run: poetry install -E compiler
|
||||||
|
|
||||||
- name: Generate code from proto files
|
- name: Generate code from proto files
|
||||||
shell: bash
|
shell: bash
|
||||||
|
12
.github/workflows/code-quality.yml
vendored
12
.github/workflows/code-quality.yml
vendored
@ -14,13 +14,5 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Run Black
|
- uses: actions/setup-python@v2
|
||||||
uses: lgeiger/black-action@master
|
- uses: pre-commit/action@v2.0.3
|
||||||
with:
|
|
||||||
args: --check src/ tests/ benchmarks/
|
|
||||||
|
|
||||||
- name: Install rST dependcies
|
|
||||||
run: python -m pip install doc8
|
|
||||||
- name: Lint documentation for errors
|
|
||||||
run: python -m doc8 docs --max-line-length 88 --ignore-path-errors "docs/migrating.rst;D001"
|
|
||||||
# it has a table which is longer than 88 characters long
|
|
||||||
|
15
.pre-commit-config.yaml
Normal file
15
.pre-commit-config.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
ci:
|
||||||
|
autofix_prs: false
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.1.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/doc8
|
||||||
|
rev: 0.10.1
|
||||||
|
hooks:
|
||||||
|
- id: doc8
|
||||||
|
additional_dependencies:
|
||||||
|
- toml
|
@ -381,8 +381,7 @@ datetime.datetime(2019, 1, 1, 11, 59, 58, 800000, tzinfo=datetime.timezone.utc)
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Get set up with the virtual env & dependencies
|
# Get set up with the virtual env & dependencies
|
||||||
poetry run pip install --upgrade pip
|
poetry install -E compiler
|
||||||
poetry install
|
|
||||||
|
|
||||||
# Activate the poetry environment
|
# Activate the poetry environment
|
||||||
poetry shell
|
poetry shell
|
||||||
|
1702
poetry.lock
generated
Normal file
1702
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,6 @@ python-dateutil = "^2.8"
|
|||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
asv = "^0.4.2"
|
asv = "^0.4.2"
|
||||||
black = "^21.11b0"
|
|
||||||
bpython = "^0.19"
|
bpython = "^0.19"
|
||||||
grpcio-tools = "^1.40.0"
|
grpcio-tools = "^1.40.0"
|
||||||
jinja2 = ">=2.11.2"
|
jinja2 = ">=2.11.2"
|
||||||
@ -36,6 +35,7 @@ sphinx = "3.1.2"
|
|||||||
sphinx-rtd-theme = "0.5.0"
|
sphinx-rtd-theme = "0.5.0"
|
||||||
tomlkit = "^0.7.0"
|
tomlkit = "^0.7.0"
|
||||||
tox = "^3.15.1"
|
tox = "^3.15.1"
|
||||||
|
pre-commit = "^2.17.0"
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
@ -97,13 +97,22 @@ shell = "poe generate && tox"
|
|||||||
help = "Run tests with multiple pythons"
|
help = "Run tests with multiple pythons"
|
||||||
|
|
||||||
[tool.poe.tasks.check-style]
|
[tool.poe.tasks.check-style]
|
||||||
cmd = "black . --check --diff --exclude tests/output_"
|
cmd = "black . --check --diff"
|
||||||
help = "Check if code style is correct"
|
help = "Check if code style is correct"
|
||||||
|
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ['py36']
|
target-version = ['py36']
|
||||||
|
|
||||||
|
[tool.doc8]
|
||||||
|
paths = ["docs"]
|
||||||
|
max_line_length = 88
|
||||||
|
|
||||||
|
[tool.doc8.ignore_path_errors]
|
||||||
|
"docs/migrating.rst" = [
|
||||||
|
"D001", # contains table which is longer than 88 characters long
|
||||||
|
]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
omit = ["betterproto/tests/*"]
|
omit = ["betterproto/tests/*"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user