Merge #13210: Enable W191 indentation contains tabs and W291 trailing whitespace flake8 checks for Python files

0d31ef4762 Enable W191 and W291 flake8 checks. Remove trailing whitespace from Python files. Convert tabs to spaces. (John Bampton)

Pull request description:

Tree-SHA512: d062434310d6232469d7ca8e5f2ddb7db7e85cb2a299e609d98bacc318368e43e0777c9f4966df03d50f526bbe27207faa87a7464e62e14671194459a06ad969
This commit is contained in:
MarcoFalke 2018-05-10 20:59:36 -04:00 committed by pasta
parent ffc38301f7
commit 18eebe5251
3 changed files with 6 additions and 4 deletions

View File

@ -508,7 +508,7 @@ def file_has_hashbang(file_lines):
def insert_python_header(filename, file_lines, start_year, end_year): def insert_python_header(filename, file_lines, start_year, end_year):
if file_has_hashbang(file_lines): if file_has_hashbang(file_lines):
insert_idx = 1 insert_idx = 1
else: else:
insert_idx = 0 insert_idx = 0
header_lines = get_python_header_lines_to_insert(start_year, end_year) header_lines = get_python_header_lines_to_insert(start_year, end_year)
@ -573,7 +573,7 @@ def insert_cmd(argv):
if extension not in ['.h', '.cpp', '.cc', '.c', '.py']: if extension not in ['.h', '.cpp', '.cc', '.c', '.py']:
sys.exit("*** cannot insert for file extension %s" % extension) sys.exit("*** cannot insert for file extension %s" % extension)
if extension == '.py': if extension == '.py':
style = 'python' style = 'python'
else: else:
style = 'cpp' style = 'cpp'

View File

@ -62,6 +62,8 @@ export LC_ALL=C
# F822 undefined name name in __all__ # F822 undefined name name in __all__
# F823 local variable name … referenced before assignment # F823 local variable name … referenced before assignment
# F831 duplicate argument name in function definition # F831 duplicate argument name in function definition
# W191 indentation contains tabs
# W291 trailing whitespace
# W292 no newline at end of file # W292 no newline at end of file
# W293 blank line contains whitespace # W293 blank line contains whitespace
# W504 line break after binary operator # disabled # W504 line break after binary operator # disabled
@ -72,4 +74,4 @@ export LC_ALL=C
# W605 invalid escape sequence "x" # disabled # W605 invalid escape sequence "x" # disabled
# W606 'async' and 'await' are reserved keywords starting with Python 3.7 # W606 'async' and 'await' are reserved keywords starting with Python 3.7
git ls-files "*.py" | xargs flake8 --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,W292,W293,W601,W602,W603,W604,W606 #,E741,W504,W605 git ls-files "*.py" | xargs flake8 --ignore=B,C,E,F,I,N,W --select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E742,E743,F401,E901,E902,F402,F404,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,W191,W291,W292,W601,W602,W603,W604,W606 #,E741,W504,W605

View File

@ -150,7 +150,7 @@ def check_PE_DYNAMIC_BASE(executable):
def check_PE_HIGH_ENTROPY_VA(executable): def check_PE_HIGH_ENTROPY_VA(executable):
'''PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR''' '''PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR'''
(arch,bits) = get_PE_dll_characteristics(executable) (arch,bits) = get_PE_dll_characteristics(executable)
if arch == 'i386:x86-64': if arch == 'i386:x86-64':
reqbits = IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA reqbits = IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
else: # Unnecessary on 32-bit else: # Unnecessary on 32-bit
assert(arch == 'i386') assert(arch == 'i386')