-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake8
174 lines (133 loc) · 8.82 KB
/
flake8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#-----------------------------------------------------------------------------------------------------------------------
#
# Flake8 Configuration File
#
#
# Description:
#
# This file contains the Flake8 configuration used when linting Python code.
#
# This file defines the default configuration and behavior when performing linting on the specified Python programs
# for style and potential errors. This determines the strictness of checking and common exceptions to the normal
# rules.
#
#-----------------------------------------------------------------------------------------------------------------------
[flake8]
#-----------------------------------------------------------------------------------------------------------------------
# General Options
#-----------------------------------------------------------------------------------------------------------------------
# The maximum length any line in source code can be. This differs from the PEP 8 recommendation of 79 characters
# per line. There are some exceptions to this rule, such as strings or comments that are entirely URLs.
max-line-length = 120
# The maximum McCabe (cyclomatic) complexity that is allowed in a block of code (function or method typically). The
# McCabe complexity is the number of linearily independent paths through a section of source code. For more
# information, see:
#
# https://en.wikipedia.org/wiki/Cyclomatic_complexity
max-complexity = 15
#-----------------------------------------------------------------------------------------------------------------------
# Plugin Options
#-----------------------------------------------------------------------------------------------------------------------
# The style convention to use when checking docstrings with the flake8-docstrings and flake8-darglint plugins.
docstring-convention = google
docstring-style = google
# The maximum permitted complexity for any given expression in code for the flake8-expression-complexity plugin.
# This is simply the number of subexpressions that are in a single expression.
max-expression-complexity = 10
# The import style to use when checking import ordering with the flake8-import-order plugin.
import-order-style = google
# Make the flake8-literal plugin enforce using double quotes for multiline string literals.
literal-multiline-quotes = double
# Disallow blanket Flake8 linting suppression comments (# noqa) for the flake8-noqa plugin by requiring a code to
# always be specified.
noqa-require-code = true
# Ignore the warnings generated by the flake8-unused-arguments plugins for abstract functions, variadic arguments
# (i.e. *args and **kwargs), lambda, and stub functions (functions without bodies).
unused-arguments-ignore-abstract-functions = true
unused-arguments-ignore-lambdas = true
unused-arguments-ignore-stub-functions = true
unused-arguments-ignore-variadic-names = true
#-----------------------------------------------------------------------------------------------------------------------
# Ignored Rules
#-----------------------------------------------------------------------------------------------------------------------
# The list of linting codes to ignore (i.e. allow violations of) when linting code. Note that this overrides the
# default set of ignored codes by Flake8 (and all its plugins), so this implicitly enables all linting codes and
# then disables some. However, some of the original default ignores are included.
ignore =
# [Default] Ignore a line being under indented for hanging indents. Hanging indents are when all lines in
# a "paragraph" are indented except the first line. This allows for code blocks like multiline dictionaries
# to have an arbitrary indentation, not simply restricted to being 4 spaces.
E121,
# [Default] Ignore a line being over indented for hanging indents. This covers the other case for hanging
# indents, allowing them to be greater than 4 spaces.
E126,
# Allow for having multiple spaces before an operator. While this is generally undesired, this
# rule also prevents assignment statements from being aligned along the '=' operator. Since this rule
# applies to all operators, it is disabled to prevent this case. E222 covers when there are too many spaces
# after the operator.
E221,
# Allow for additional spaces after separators used in collection literals (e.g. ",", ":"). While this does
# permit some bad patterns, it allows for visually aligned dictionary and tuple literals.
E241,
# Allow for additional spaces around a keyword or default valued parameter in a function definition or call.
# This allows for code like `f(x = 'y')`, instead of forcing it to be `f(x='y')`.
E251,
# [Default] Allow for line breaks before a binary operator. This, along with including W504 implicitly,
# ensures that breaking expressions over multiple lines requires that new lines start with the operator,
# rather than leaving the operator on the previous line. For example, `x + y` becomes `x\n + y`.
W503,
# [Plugin: flake8-bandit] Allow for assert statements even though they are removed in optimized byte code as
# this is not a typical use case.
S101,
# [Plugin: flake8-bandit] Suppress the linting messages that say to consider the security implications of
# using various modules (e.g. subprocess, pickle, etc.).
S403,
S404,
# [Plugin: flake8-bandit] Suppress linting messages related to using subprocess with a partial path and a
# notice to check for untrusted input.
S603,
S607,
# [Plugin: flake8-comprehensions] Allow for using dict/list/tuple calls instead of using the equivalent
# literal. This allows for using `dict()` instead of forcing code to use `{}` for the expression.
C408,
# [Plugin: flake8-darglint] Allow for excess exceptions in the function docstring. Darglint will only detect
# exceptions that are explicitly raised in the function and it useful to also list exceptions raised by called
# functions (which aren't caught by the current function).
DAR402,
# [Plugin: flake8-docstring] Allow for a blank line to be after a function docstring. This tends to yield
# cleaner looking code.
D202,
# [Plugin: flake8-docstring] Allow for the first line of a multi-line docstring summary (i.e. module
# comment) to start with an empty line. This looks a bit cleaner as it aligns with the rest of the text.
D212,
# [Plugin: flake8-docstring] Allow for the first line of a docstring to not end with punctuation. This is
# useful for module comments where a title is generally put. Unfortunately, this also applies to function
# docstrings, but this is acceptable.
D415,
# [Plugin: flake8-pyi] Allow for docstrings to be included in Python type stub files, mostly because they
# can be used to define interfaces to C++ Python binding modules.
Y021,
# [Plugin: flake8-secure-coding-standard] Allow for assert statements, even in production code, as they are
# useful.
SCS108,
# The list of specific linting codes to ignore on a file by file basis. Codes listed here are appended to the codes
# specified by the ignore option.
per-file-ignores =
# Type stubs are generally used to define interfaces. Sometimes, these are interfaces to C++ Python binding
# modules, which will generally not follow Python naming rules. Also, unused arguments, class level expressions
# may be present (due to using '...' in class bodies), and missing docstrings are expected, except for the
# module-level one.
*.pyi:N8,CCE002,D101,D102,D103,D104,D105,D106,D107
# Module init files generally only import files locally and may have some more complex logic, so they are
# permitted to import dependent modules in whatever order they please.
__init__.py:I100,I202
#-----------------------------------------------------------------------------------------------------------------------
# Output Formatting Options
#-----------------------------------------------------------------------------------------------------------------------
# Display a line at the end of the output for the total number of errors.
count = True
# Display a series of summary lines at the end of the output that indicate the number of occurrences of each lint
# violation code. This is helpful in determining the number of each type of linting violation.
statistics = True
# Display the source code snippet that caused the lint violation when printing the output.
show-source = True