Use pre-commit for pep8 checks
pre-commit was introduced in several repos and is known to be useful. It allows us to easily add more checks. Change-Id: Ic551481a98d9c3f2e5aaf430108bf4e3d2501ebf Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
24
.pre-commit-config.yaml
Normal file
24
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix', 'lf']
|
||||
exclude: '.*\.(svg)$'
|
||||
- id: fix-byte-order-marker
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
- repo: https://opendev.org/openstack/hacking
|
||||
rev: 7.0.0
|
||||
hooks:
|
||||
- id: hacking
|
||||
additional_dependencies: []
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/PyCQA/doc8
|
||||
rev: v2.0.0
|
||||
hooks:
|
||||
- id: doc8
|
||||
@@ -31,8 +31,10 @@ Comments
|
||||
|
||||
Identifiers
|
||||
-----------
|
||||
- Don't use single characters in identifiers except in trivial loop variables and mathematical algorithms.
|
||||
- Avoid abbreviations, especially if they are ambiguous or their meaning would not be immediately clear to the casual reader or newcomer.
|
||||
- Don't use single characters in identifiers except in trivial loop variables
|
||||
and mathematical algorithms.
|
||||
- Avoid abbreviations, especially if they are ambiguous or their meaning would
|
||||
not be immediately clear to the casual reader or newcomer.
|
||||
|
||||
Wrapping
|
||||
--------
|
||||
@@ -68,7 +70,8 @@ Example::
|
||||
|
||||
Imports
|
||||
-------
|
||||
- Classes and functions may be hoisted into a package namespace, via __init__ files, with some discretion.
|
||||
- Classes and functions may be hoisted into a package namespace, via
|
||||
__init__ files, with some discretion.
|
||||
|
||||
More Import Examples
|
||||
--------------------
|
||||
|
||||
@@ -46,4 +46,4 @@ format=%(asctime)s %(levelname)s %(message)s
|
||||
format=(%(name)s): %(asctime)s %(levelname)s %(message)s
|
||||
|
||||
[formatter_debug]
|
||||
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s
|
||||
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s
|
||||
|
||||
@@ -17,7 +17,7 @@ ws.onopen = () => {
|
||||
ws.send('{"action": "authenticate", "headers": {"X-Auth-Token": \
|
||||
"8444886dd9b04a1b87ddb502b508261c", "X-Project-ID": \
|
||||
"7530fad032ca431e9dc8ed4a5de5d99c"}}'); // refer to bug #1553398
|
||||
|
||||
|
||||
ws.send('{"action": "message_post", "body": {"messages": [{"body": \
|
||||
"Zaqar Sample"}], "queue_name": "SampleQueue"}, "headers": \
|
||||
{"Client-ID": "355186cd-d1e8-4108-a3ac-a2183697232a", "X-Project-ID": \
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class SampleZaqarServlet extends HttpServlet {
|
||||
|
||||
headers.putSingle("X-Auth-Token", "8444886dd9b04a1b87ddb502b508261c");
|
||||
|
||||
headers.putSingle("X-Project-Id", "7530fad032ca431e9dc8ed4a5de5d99c");
|
||||
headers.putSingle("X-Project-Id", "7530fad032ca431e9dc8ed4a5de5d99c");
|
||||
|
||||
final Response res = client
|
||||
.target("http://localhost:8888/v2/queues/SampleQueue/claims")
|
||||
|
||||
@@ -17,7 +17,7 @@ const ws = new WebSocket('ws://localhost:9000');
|
||||
|
||||
ws.on('message', (data, flags) => {
|
||||
const msg = JSON.parse(data);
|
||||
|
||||
|
||||
if (msg.body.messages)
|
||||
console.log(msg.body.messages[0].body);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||
hacking>=7.0.0,<7.1.0 # Apache-2.0
|
||||
|
||||
# Backends
|
||||
redis>=3.4.0 # MIT
|
||||
@@ -11,7 +11,6 @@ PyMySQL>=0.8.0 # MIT License
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
cryptography>=2.7 # BSD/Apache-2.0
|
||||
ddt>=1.0.1 # MIT
|
||||
doc8>=0.8.1 # Apache-2.0
|
||||
Pygments>=2.2.0 # BSD license
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
|
||||
|
||||
6
tox.ini
6
tox.ini
@@ -25,9 +25,10 @@ setenv =
|
||||
OS_TEST_PATH=./zaqar/tests/functional
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
pre-commit
|
||||
commands =
|
||||
doc8 doc/source
|
||||
flake8
|
||||
pre-commit run -a
|
||||
|
||||
[testenv:genconfig]
|
||||
commands =
|
||||
@@ -80,7 +81,6 @@ deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
doc8 releasenotes/source releasenotes/notes
|
||||
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[flake8]
|
||||
|
||||
Reference in New Issue
Block a user