remove H904
this is really an overreach on preference, and not something which we should be machine enforcing. Change-Id: Ia4dcaa58d33cc71c726f52a0e696e6702819e2de
This commit is contained in:
@@ -20,7 +20,8 @@ Step 0
|
||||
General
|
||||
-------
|
||||
- [H903] Use only UNIX style newlines (``\n``), not Windows style (``\r\n``)
|
||||
- [H904] Wrap long lines in parentheses and not a backslash for line continuation.
|
||||
- It is prefered to wrap long lines in parentheses and not a backslash
|
||||
for line continuation.
|
||||
- [H201] Do not write ``except:``, use ``except Exception:`` at the very least
|
||||
- [H101] Include your name with TODOs as in ``# TODO(yourname)``
|
||||
- Do not shadow a built-in or reserved word. Example::
|
||||
|
||||
@@ -25,19 +25,3 @@ def hacking_no_cr(physical_line):
|
||||
pos = physical_line.find('\r')
|
||||
if pos != -1 and pos == (len(physical_line) - 2):
|
||||
return (pos, "H903: Windows style line endings not allowed in code")
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_no_backslash_line_continuation(logical_line, tokens):
|
||||
r"""Wrap lines in parentheses and not a backslash for line continuation.
|
||||
|
||||
Okay: a = (5 +\n 6)
|
||||
H904: b = 5 + \\\n 6
|
||||
"""
|
||||
found = False
|
||||
for token_type, text, start_index, stop_index, line in tokens:
|
||||
if line.rstrip('\r\n').endswith('\\') and not found:
|
||||
found = True
|
||||
yield ((start_index[0], start_index[1]+len(line.strip())-1),
|
||||
"H904: Wrap long lines in parentheses instead of a "
|
||||
"backslash")
|
||||
|
||||
@@ -54,7 +54,6 @@ flake8.extension =
|
||||
H801 = hacking.checks.git:OnceGitCheckCommitTitleBug
|
||||
H802 = hacking.checks.git:OnceGitCheckCommitTitleLength
|
||||
H903 = hacking.checks.other:hacking_no_cr
|
||||
H904 = hacking.checks.other:hacking_no_backslash_line_continuation
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
|
||||
Reference in New Issue
Block a user