setup.cfg
10474 bytes
1# Python settings for QMK
2[flake8]
3ignore =
4 # QMK is ok with long lines.
5 E501
6 # Conflicts with our yapf config
7 E231
8per_file_ignores =
9 # Module imported but unused
10 **/__init__.py:F401
11 # Quantum Painter also outputs append data using bytes object arithmetic on multiple lines
12 **/painter_qgf.py:W503
13 **/painter_qff.py:W503
14
15# Let's slowly crank this down
16max_complexity=16
17
18[yapf]
19# Align closing bracket with visual indentation.
20align_closing_bracket_with_visual_indent=True
21
22# Allow dictionary keys to exist on multiple lines. For example:
23#
24# x = {
25# ('this is the first element of a tuple',
26# 'this is the second element of a tuple'):
27# value,
28# }
29allow_multiline_dictionary_keys=False
30
31# Allow lambdas to be formatted on more than one line.
32allow_multiline_lambdas=False
33
34# Allow splitting before a default / named assignment in an argument list.
35allow_split_before_default_or_named_assigns=True
36
37# Allow splits before the dictionary value.
38allow_split_before_dict_value=True
39
40# Let spacing indicate operator precedence. For example:
41#
42# a = 1 * 2 + 3 / 4
43# b = 1 / 2 - 3 * 4
44# c = (1 + 2) * (3 - 4)
45# d = (1 - 2) / (3 + 4)
46# e = 1 * 2 - 3
47# f = 1 + 2 + 3 + 4
48#
49# will be formatted as follows to indicate precedence:
50#
51# a = 1*2 + 3/4
52# b = 1/2 - 3*4
53# c = (1+2) * (3-4)
54# d = (1-2) / (3+4)
55# e = 1*2 - 3
56# f = 1 + 2 + 3 + 4
57#
58arithmetic_precedence_indication=False
59
60# Number of blank lines surrounding top-level function and class
61# definitions.
62blank_lines_around_top_level_definition=2
63
64# Insert a blank line before a class-level docstring.
65blank_line_before_class_docstring=False
66
67# Insert a blank line before a module docstring.
68blank_line_before_module_docstring=False
69
70# Insert a blank line before a 'def' or 'class' immediately nested
71# within another 'def' or 'class'. For example:
72#
73# class Foo:
74# # <------ this blank line
75# def method():
76# ...
77blank_line_before_nested_class_or_def=False
78
79# Do not split consecutive brackets. Only relevant when
80# dedent_closing_brackets is set. For example:
81#
82# call_func_that_takes_a_dict(
83# {
84# 'key1': 'value1',
85# 'key2': 'value2',
86# }
87# )
88#
89# would reformat to:
90#
91# call_func_that_takes_a_dict({
92# 'key1': 'value1',
93# 'key2': 'value2',
94# })
95coalesce_brackets=True
96
97# The column limit.
98column_limit=256
99
100# The style for continuation alignment. Possible values are:
101#
102# - SPACE: Use spaces for continuation alignment. This is default behavior.
103# - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns
104# (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs) for continuation
105# alignment.
106# - VALIGN-RIGHT: Vertically align continuation lines with indent
107# characters. Slightly right (one more indent character) if cannot
108# vertically align continuation lines with indent characters.
109#
110# For options FIXED, and VALIGN-RIGHT are only available when USE_TABS is
111# enabled.
112continuation_align_style=SPACE
113
114# Indent width used for line continuations.
115continuation_indent_width=4
116
117# Put closing brackets on a separate line, dedented, if the bracketed
118# expression can't fit in a single line. Applies to all kinds of brackets,
119# including function definitions and calls. For example:
120#
121# config = {
122# 'key1': 'value1',
123# 'key2': 'value2',
124# } # <--- this bracket is dedented and on a separate line
125#
126# time_series = self.remote_client.query_entity_counters(
127# entity='dev3246.region1',
128# key='dns.query_latency_tcp',
129# transform=Transformation.AVERAGE(window=timedelta(seconds=60)),
130# start_ts=now()-timedelta(days=3),
131# end_ts=now(),
132# ) # <--- this bracket is dedented and on a separate line
133dedent_closing_brackets=True
134
135# Disable the heuristic which places each list element on a separate line
136# if the list is comma-terminated.
137disable_ending_comma_heuristic=False
138
139# Place each dictionary entry onto its own line.
140each_dict_entry_on_separate_line=True
141
142# The regex for an i18n comment. The presence of this comment stops
143# reformatting of that line, because the comments are required to be
144# next to the string they translate.
145i18n_comment=
146
147# The i18n function call names. The presence of this function stops
148# reformattting on that line, because the string it has cannot be moved
149# away from the i18n comment.
150i18n_function_call=
151
152# Indent blank lines.
153indent_blank_lines=False
154
155# Indent the dictionary value if it cannot fit on the same line as the
156# dictionary key. For example:
157#
158# config = {
159# 'key1':
160# 'value1',
161# 'key2': value1 +
162# value2,
163# }
164indent_dictionary_value=True
165
166# The number of columns to use for indentation.
167indent_width=4
168
169# Join short lines into one line. E.g., single line 'if' statements.
170join_multiple_lines=False
171
172# Do not include spaces around selected binary operators. For example:
173#
174# 1 + 2 * 3 - 4 / 5
175#
176# will be formatted as follows when configured with "*,/":
177#
178# 1 + 2*3 - 4/5
179no_spaces_around_selected_binary_operators=
180
181# Use spaces around default or named assigns.
182spaces_around_default_or_named_assign=False
183
184# Use spaces around the power operator.
185spaces_around_power_operator=False
186
187# The number of spaces required before a trailing comment.
188# This can be a single value (representing the number of spaces
189# before each trailing comment) or list of values (representing
190# alignment column values; trailing comments within a block will
191# be aligned to the first column value that is greater than the maximum
192# line length within the block). For example:
193#
194# With spaces_before_comment=5:
195#
196# 1 + 1 # Adding values
197#
198# will be formatted as:
199#
200# 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment
201#
202# With spaces_before_comment=15, 20:
203#
204# 1 + 1 # Adding values
205# two + two # More adding
206#
207# longer_statement # This is a longer statement
208# short # This is a shorter statement
209#
210# a_very_long_statement_that_extends_beyond_the_final_column # Comment
211# short # This is a shorter statement
212#
213# will be formatted as:
214#
215# 1 + 1 # Adding values <-- end of line comments in block aligned to col 15
216# two + two # More adding
217#
218# longer_statement # This is a longer statement <-- end of line comments in block aligned to col 20
219# short # This is a shorter statement
220#
221# a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments are aligned based on the line length
222# short # This is a shorter statement
223#
224spaces_before_comment=2
225
226# Insert a space between the ending comma and closing bracket of a list,
227# etc.
228space_between_ending_comma_and_closing_bracket=False
229
230# Split before arguments
231split_all_comma_separated_values=False
232
233# Split before arguments if the argument list is terminated by a
234# comma.
235split_arguments_when_comma_terminated=True
236
237# Set to True to prefer splitting before '+', '-', '*', '/', '//', or '@'
238# rather than after.
239split_before_arithmetic_operator=False
240
241# Set to True to prefer splitting before '&', '|' or '^' rather than
242# after.
243split_before_bitwise_operator=True
244
245# Split before the closing bracket if a list or dict literal doesn't fit on
246# a single line.
247split_before_closing_bracket=True
248
249# Split before a dictionary or set generator (comp_for). For example, note
250# the split before the 'for':
251#
252# foo = {
253# variable: 'Hello world, have a nice day!'
254# for variable in bar if variable != 42
255# }
256split_before_dict_set_generator=True
257
258# Split before the '.' if we need to split a longer expression:
259#
260# foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d))
261#
262# would reformat to something like:
263#
264# foo = ('This is a really long string: {}, {}, {}, {}'
265# .format(a, b, c, d))
266split_before_dot=False
267
268# Split after the opening paren which surrounds an expression if it doesn't
269# fit on a single line.
270split_before_expression_after_opening_paren=False
271
272# If an argument / parameter list is going to be split, then split before
273# the first argument.
274split_before_first_argument=False
275
276# Set to True to prefer splitting before 'and' or 'or' rather than
277# after.
278split_before_logical_operator=False
279
280# Split named assignments onto individual lines.
281split_before_named_assigns=True
282
283# Set to True to split list comprehensions and generators that have
284# non-trivial expressions and multiple clauses before each of these
285# clauses. For example:
286#
287# result = [
288# a_long_var + 100 for a_long_var in xrange(1000)
289# if a_long_var % 10]
290#
291# would reformat to something like:
292#
293# result = [
294# a_long_var + 100
295# for a_long_var in xrange(1000)
296# if a_long_var % 10]
297split_complex_comprehension=True
298
299# The penalty for splitting right after the opening bracket.
300split_penalty_after_opening_bracket=300
301
302# The penalty for splitting the line after a unary operator.
303split_penalty_after_unary_operator=10000
304
305# The penalty of splitting the line around the '+', '-', '*', '/', '//',
306# ``%``, and '@' operators.
307split_penalty_arithmetic_operator=300
308
309# The penalty for splitting right before an if expression.
310split_penalty_before_if_expr=0
311
312# The penalty of splitting the line around the '&', '|', and '^'
313# operators.
314split_penalty_bitwise_operator=300
315
316# The penalty for splitting a list comprehension or generator
317# expression.
318split_penalty_comprehension=80
319
320# The penalty for characters over the column limit.
321split_penalty_excess_character=7000
322
323# The penalty incurred by adding a line split to the unwrapped line. The
324# more line splits added the higher the penalty.
325split_penalty_for_added_line_split=30
326
327# The penalty of splitting a list of "import as" names. For example:
328#
329# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1,
330# long_argument_2,
331# long_argument_3)
332#
333# would reformat to something like:
334#
335# from a_very_long_or_indented_module_name_yada_yad import (
336# long_argument_1, long_argument_2, long_argument_3)
337split_penalty_import_names=0
338
339# The penalty of splitting the line around the 'and' and 'or'
340# operators.
341split_penalty_logical_operator=300
342
343# Use the Tab character for indentation.
344use_tabs=False