src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py

branch
eric7
changeset 11148
15e30f0c76a8
parent 11090
f5f5f5803935
child 11150
73d80859079c
equal deleted inserted replaced
11147:dee6e106b4d3 11148:15e30f0c76a8
287 have several windows side-by-side. The default wrapping on such 287 have several windows side-by-side. The default wrapping on such
288 devices looks ugly. Therefore, please limit all lines to a maximum 288 devices looks ugly. Therefore, please limit all lines to a maximum
289 of 79 characters. For flowing long blocks of text (docstrings or 289 of 79 characters. For flowing long blocks of text (docstrings or
290 comments), limiting the length to 72 characters is recommended. 290 comments), limiting the length to 72 characters is recommended.
291 291
292 Reports error E501. 292 Reports error E-501.
293 """ 293 """
294 line = physical_line.rstrip() 294 line = physical_line.rstrip()
295 length = len(line) 295 length = len(line)
296 if length > max_line_length and not noqa: 296 if length > max_line_length and not noqa:
297 # Special case: ignore long shebang lines. 297 # Special case: ignore long shebang lines.
304 if ((len(chunks) == 1 and multiline) or 304 if ((len(chunks) == 1 and multiline) or
305 (len(chunks) == 2 and chunks[0] == '#')) and \ 305 (len(chunks) == 2 and chunks[0] == '#')) and \
306 len(line) - len(chunks[-1]) < max_line_length - 7: 306 len(line) - len(chunks[-1]) < max_line_length - 7:
307 return 307 return
308 if length > max_line_length: 308 if length > max_line_length:
309 return (max_line_length, "E501 line too long " 309 return (max_line_length, "E-501 line too long "
310 "(%d > %d characters)" % (length, max_line_length), 310 "(%d > %d characters)" % (length, max_line_length),
311 length, max_line_length) 311 length, max_line_length)
312 312
313 313
314 ######################################################################## 314 ########################################################################
920 if next_char not in WHITESPACE and next_char not in '\r\n': 920 if next_char not in WHITESPACE and next_char not in '\r\n':
921 # slice 921 # slice
922 if text == ':' and brace_stack[-1:] == ['[']: 922 if text == ':' and brace_stack[-1:] == ['[']:
923 pass 923 pass
924 # 3.12+ fstring format specifier 924 # 3.12+ fstring format specifier
925 elif text == ':' and brace_stack[-2:] == ['f', '{']: # pragma: >=3.12 cover # noqa: E501 925 elif text == ':' and brace_stack[-2:] == ['f', '{']: # pragma: >=3.12 cover # noqa: E-501
926 pass 926 pass
927 # tuple (and list for some reason?) 927 # tuple (and list for some reason?)
928 elif text == ',' and next_char in ')]': 928 elif text == ',' and next_char in ')]':
929 pass 929 pass
930 else: 930 else:
2731 2731
2732 2732
2733 if __name__ == '__main__': 2733 if __name__ == '__main__':
2734 _main() 2734 _main()
2735 # 2735 #
2736 # eflag: noqa = D2, M601, M801 2736 # eflag: noqa = D2, M-601, M-801

eric ide

mercurial