0002-ci-add-pre-commit-56062.patch
.git-blame-ignore-revs | ||
---|---|---|
1 |
# misc: apply pyupgrade/isort/black (#56062) |
|
2 |
65d33f00b7a0e9b5c75dde1b92c1484de740030e |
.pre-commit-config.yaml | ||
---|---|---|
1 |
# See https://pre-commit.com for more information |
|
2 |
# See https://pre-commit.com/hooks.html for more hooks |
|
3 |
repos: |
|
4 |
- repo: https://github.com/asottile/pyupgrade |
|
5 |
rev: v2.20.0 |
|
6 |
hooks: |
|
7 |
- id: pyupgrade |
|
8 |
args: ['--keep-percent-format', '--py37-plus'] |
|
9 |
- repo: https://github.com/PyCQA/isort |
|
10 |
rev: 5.7.0 |
|
11 |
hooks: |
|
12 |
- id: isort |
|
13 |
args: ['--profile', 'black', '--line-length', '110'] |
|
14 |
- repo: https://github.com/psf/black |
|
15 |
rev: 20.8b1 |
|
16 |
hooks: |
|
17 |
- id: black |
|
18 |
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] |
README.rst | ||
---|---|---|
220 | 220 |
The `count` measure is a special measure which is always present whose |
221 | 221 |
expression is always `count({fact_table}.{key})` where `fact_table` and `key` |
222 | 222 |
are the corresponding attributes of the cube. |
223 | ||
224 |
Code Style |
|
225 |
========== |
|
226 | ||
227 |
black is used to format the code, using thoses parameters: |
|
228 | ||
229 |
black --target-version py37 --skip-string-normalization --line-length 110 |
|
230 | ||
231 |
There is .pre-commit-config.yaml to use pre-commit to automatically run black |
|
232 |
before commits. (execute `pre-commit install` to install the git hook.) |
|
233 | ||
234 |
isort is used to format the imports, using those parameter: |
|
235 | ||
236 |
isort --profile black --line-length 110 |
|
237 | ||
238 |
pyupgrade is used to automatically upgrade syntax, using those parameters: |
|
239 | ||
240 |
pyupgrade --keep-percent-format --py37-plus |
|
241 | ||
242 |
There is .pre-commit-config.yaml to use pre-commit to automatically run black, |
|
243 |
isort and pyupgrade before commits. (execute `pre-commit install` to install |
|
244 |
the git hook.) |
tox.ini | ||
---|---|---|
5 | 5 | |
6 | 6 |
[tox] |
7 | 7 |
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/{env:BRANCH_NAME:} |
8 |
envlist = py3-dj22 |
|
8 |
envlist = |
|
9 |
py3-dj22 |
|
10 |
code-style |
|
11 | ||
12 |
[testenv:code-style] |
|
13 |
skip_install = true |
|
14 |
deps = |
|
15 |
pre-commit |
|
16 |
commands = |
|
17 |
pre-commit run --all-files --show-diff-on-failure |
|
9 | 18 | |
10 | 19 |
[testenv] |
11 | 20 |
usedevelop = true |
... | ... | |
31 | 40 |
dj22: https://git.entrouvert.org/hobo.git/snapshot/hobo-main.tar.gz |
32 | 41 |
commands = |
33 | 42 |
py3-dj22: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe tests/} |
43 | ||
34 | 44 |
[pytest] |
35 | 45 |
filterwarnings = |
36 | 46 |
once:.* |
37 |
- |