Skip semi-colon test with findIf (#6584)

* Skip semi-colon test with findIf

* Fix  #6186

* column cleanser
This commit is contained in:
PabstMirror 2018-09-20 14:34:59 -05:00 committed by GitHub
parent 0a2f5cf238
commit afbf2049ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ import sys
import argparse
def validKeyWordAfterCode(content, index):
keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch", "param", "select", "apply", "findIf"];
keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch", "param", "select", "apply", "findIf", "remoteExec"];
for word in keyWords:
try:
subWord = content.index(word, index, index+len(word))
@ -47,7 +47,7 @@ def check_sqf_syntax(filepath):
inStringType = '';
lastIsCurlyBrace = False
checkForSemiColumn = False
checkForSemicolon = False
# Extra information so we know what line we find errors at
lineNumber = 1
@ -57,7 +57,8 @@ def check_sqf_syntax(filepath):
for c in content:
if (lastIsCurlyBrace):
lastIsCurlyBrace = False
checkForSemiColumn = True
# Test generates false positives with binary commands that take CODE as 2nd arg (e.g. findIf)
checkForSemicolon = not re.search('findIf', content, re.IGNORECASE)
if c == '\n': # Keeping track of our line numbers
lineNumber += 1 # so we can print accurate line number information when we detect a possible error
@ -113,11 +114,11 @@ def check_sqf_syntax(filepath):
print("ERROR: Tab detected at {0} Line number: {1}".format(filepath,lineNumber))
bad_count_file += 1
if (checkForSemiColumn):
if (checkForSemicolon):
if (c not in [' ', '\t', '\n', '/']): # keep reading until no white space or comments
checkForSemiColumn = False
checkForSemicolon = False
if (c not in [']', ')', '}', ';', ',', '&', '!', '|', '='] and not validKeyWordAfterCode(content, indexOfCharacter)): # , 'f', 'd', 'c', 'e', 'a', 'n', 'i']):
print("ERROR: Possible missing semi-column ';' detected at {0} Line number: {1}".format(filepath,lineNumber))
print("ERROR: Possible missing semicolon ';' detected at {0} Line number: {1}".format(filepath,lineNumber))
bad_count_file += 1
else: # Look for the end of our comment block