ci: add pre-commit (#56062)
This commit is contained in:
parent
65d33f00b7
commit
be83c18e28
|
@ -0,0 +1,2 @@
|
||||||
|
# misc: apply pyupgrade/isort/black (#56062)
|
||||||
|
65d33f00b7a0e9b5c75dde1b92c1484de740030e
|
|
@ -0,0 +1,18 @@
|
||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.20.0
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: ['--keep-percent-format', '--py37-plus']
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.7.0
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
args: ['--profile', 'black', '--line-length', '110']
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 20.8b1
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
22
README.rst
22
README.rst
|
@ -220,3 +220,25 @@ measures also in the same ordre as the query.
|
||||||
The `count` measure is a special measure which is always present whose
|
The `count` measure is a special measure which is always present whose
|
||||||
expression is always `count({fact_table}.{key})` where `fact_table` and `key`
|
expression is always `count({fact_table}.{key})` where `fact_table` and `key`
|
||||||
are the corresponding attributes of the cube.
|
are the corresponding attributes of the cube.
|
||||||
|
|
||||||
|
Code Style
|
||||||
|
==========
|
||||||
|
|
||||||
|
black is used to format the code, using thoses parameters:
|
||||||
|
|
||||||
|
black --target-version py37 --skip-string-normalization --line-length 110
|
||||||
|
|
||||||
|
There is .pre-commit-config.yaml to use pre-commit to automatically run black
|
||||||
|
before commits. (execute `pre-commit install` to install the git hook.)
|
||||||
|
|
||||||
|
isort is used to format the imports, using those parameter:
|
||||||
|
|
||||||
|
isort --profile black --line-length 110
|
||||||
|
|
||||||
|
pyupgrade is used to automatically upgrade syntax, using those parameters:
|
||||||
|
|
||||||
|
pyupgrade --keep-percent-format --py37-plus
|
||||||
|
|
||||||
|
There is .pre-commit-config.yaml to use pre-commit to automatically run black,
|
||||||
|
isort and pyupgrade before commits. (execute `pre-commit install` to install
|
||||||
|
the git hook.)
|
||||||
|
|
12
tox.ini
12
tox.ini
|
@ -5,7 +5,16 @@
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/{env:BRANCH_NAME:}
|
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/{env:BRANCH_NAME:}
|
||||||
envlist = py3-dj22
|
envlist =
|
||||||
|
py3-dj22
|
||||||
|
code-style
|
||||||
|
|
||||||
|
[testenv:code-style]
|
||||||
|
skip_install = true
|
||||||
|
deps =
|
||||||
|
pre-commit
|
||||||
|
commands =
|
||||||
|
pre-commit run --all-files --show-diff-on-failure
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = true
|
usedevelop = true
|
||||||
|
@ -31,6 +40,7 @@ deps =
|
||||||
dj22: https://git.entrouvert.org/hobo.git/snapshot/hobo-main.tar.gz
|
dj22: https://git.entrouvert.org/hobo.git/snapshot/hobo-main.tar.gz
|
||||||
commands =
|
commands =
|
||||||
py3-dj22: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe tests/}
|
py3-dj22: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe tests/}
|
||||||
|
|
||||||
[pytest]
|
[pytest]
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
once:.*
|
once:.*
|
||||||
|
|
Loading…
Reference in New Issue