Skip to content

Commit 52a0b6b

Browse files
committed
Update format-related config and requirements
- Add black, isort, pylint and bandit to test requirements - Update indent in editorconfig to match black (4 spaces) - Add basic pylintrc file (copy-pasted from python-tuf) - gitignore pre-commit config Signed-off-by: Lukas Puehringer <[email protected]>
1 parent fb65dfe commit 52a0b6b

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ root = true
22

33
[*]
44
charset = utf-8
5-
indent_size = 2
5+
indent_size = 4
66
insert_final_newline = true
77
end_of_line = lf
88
indent_style = space

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ env/*
1515
tests/htmlcov/*
1616
.DS_Store
1717
.python-version
18+
.pre-commit-config.yaml

pylintrc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Pylint section
2+
3+
# Minimal pylint configuration file for Secure Systems Lab Python Style Guide:
4+
# https://github.com/secure-systems-lab/code-style-guidelines
5+
#
6+
# Based on Google Python Style Guide pylintrc and pylint defaults:
7+
# https://google.github.io/styleguide/pylintrc
8+
# http://pylint.pycqa.org/en/latest/technical_reference/features.html
9+
[MASTER]
10+
ignore = _vendor
11+
12+
[message_control]
13+
# Disable the message, report, category or checker with the given id(s).
14+
# NOTE: To keep this config as short as possible we only disable checks that
15+
# are currently in conflict with our code. If new code displeases the linter
16+
# (for good reasons) consider updating this config file, or disable checks with.
17+
disable =
18+
fixme,
19+
too-few-public-methods,
20+
too-many-arguments,
21+
format,
22+
duplicate-code
23+
24+
[basic]
25+
good-names = i,j,k,v,e,f,fn,fp,_type,_
26+
# Regexes for allowed names are copied from the Google pylintrc
27+
# NOTE: Pylint captures regex name groups such as 'snake_case' or 'camel_case'.
28+
# If there are multiple groups it enfoces the prevalent naming style inside
29+
# each modules. Names in the exempt capturing group are ignored.
30+
function-rgx = ^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
31+
method-rgx = (?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
32+
argument-rgx = ^[a-z][a-z0-9_]*$
33+
attr-rgx = ^_{0,2}[a-z][a-z0-9_]*$
34+
class-attribute-rgx = ^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
35+
class-rgx = ^_?[A-Z][a-zA-Z0-9]*$
36+
const-rgx = ^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
37+
inlinevar-rgx = ^[a-z][a-z0-9_]*$
38+
module-rgx = ^(_?[a-z][a-z0-9_]*|__init__)$
39+
no-docstring-rgx = (__.*__|main|test.*|.*test|.*Test)$
40+
variable-rgx = ^[a-z][a-z0-9_]*$
41+
docstring-min-length = 10
42+
43+
[logging]
44+
logging-format-style=old
45+
46+
[miscellaneous]
47+
notes=TODO
48+
49+
[STRING]
50+
check-quote-consistency=yes

requirements-test.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# additional test tools
22
coverage
3-
mypy
3+
mypy
4+
black
5+
isort
6+
pylint
7+
bandit

0 commit comments

Comments
 (0)