pylintrc_travis: Enable more messages and fix issues (#2332)

The plan is to enable more and more useful messages and fix the issues
step by step to improve the code quality.
This commit is contained in:
Sebastian 2019-11-05 21:05:43 +01:00 committed by amai2012
parent 6c9c723850
commit 0a38b1b511
3 changed files with 12 additions and 6 deletions

View File

@ -160,7 +160,7 @@ def exp42(data):
def exp15(data): def exp15(data):
for scope in data.scopes: for scope in data.scopes:
if scope.type in ('If', 'For', 'While'): if scope.type in ('If', 'For', 'While'):
token = scope.bodyStart.next token = scope.bodyStart.next
if token.str==';' and token.linenr==scope.bodyStart.linenr: if token.str==';' and token.linenr==scope.bodyStart.linenr:
reportError(token, 'style', 'Do not place a semicolon on the same line as an IF, FOR or WHILE', 'EXP15-C') reportError(token, 'style', 'Do not place a semicolon on the same line as an IF, FOR or WHILE', 'EXP15-C')
@ -232,7 +232,7 @@ def int31(data, platform):
'style', 'style',
'Ensure that integer conversions do not result in lost or misinterpreted data (casting ' + str(value.intvalue) + ' to ' + destType + ')', 'Ensure that integer conversions do not result in lost or misinterpreted data (casting ' + str(value.intvalue) + ' to ' + destType + ')',
'INT31-c') 'INT31-c')
break break
# MSC24-C # MSC24-C
# Do not use deprecated or obsolescent functions # Do not use deprecated or obsolescent functions
def msc24(data): def msc24(data):
@ -321,7 +321,7 @@ def str11(data):
if not parent.isAssignmentOp: if not parent.isAssignmentOp:
continue continue
varToken = parentOp1.astOperand1 varToken = parentOp1.astOperand1
if varToken is None or not varToken.isName: if varToken is None or not varToken.isName:
continue continue
@ -332,7 +332,7 @@ def str11(data):
valueToken = parentOp1.astOperand2 valueToken = parentOp1.astOperand2
if valueToken is None: if valueToken is None:
continue continue
if valueToken.isNumber and int(valueToken.str)==strlen: if valueToken.isNumber and int(valueToken.str)==strlen:
reportError(valueToken, 'style', 'Do not specify the bound of a character array initialized with a string literal', 'STR11-C') reportError(valueToken, 'style', 'Do not specify the bound of a character array initialized with a string literal', 'STR11-C')

View File

@ -1,6 +1,11 @@
# Just the severe stuff...
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable=C,R,W disable=C,R,W
enable=mixed-indentation,
trailing-whitespace,
print-statement,
literal-comparison,
#unnecessary-semicolon,
#bad-indentation
[REPORTS] [REPORTS]
reports=no reports=no
[TYPECHECK] [TYPECHECK]
@ -8,3 +13,4 @@ reports=no
ignored-classes=SQLObject,_socketobject ignored-classes=SQLObject,_socketobject
[MASTER] [MASTER]
init-hook='import sys; sys.path.append("./addons")' init-hook='import sys; sys.path.append("./addons")'
suggestion-mode=yes

View File

@ -119,7 +119,7 @@ if __name__ == "__main__":
else: else:
who = 'Your' who = 'Your'
crashes.append(package + ' ' + who) crashes.append(package + ' ' + who)
with open(result_file, 'a') as myfile: with open(result_file, 'a') as myfile:
myfile.write(package + '\n') myfile.write(package + '\n')
diff = lib.diff_results(work_path, 'master', results_to_diff[0], 'your', results_to_diff[1]) diff = lib.diff_results(work_path, 'master', results_to_diff[0], 'your', results_to_diff[1])