From afbf2049eae21fd9e757c48d221f9d0e47ab74f7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 20 Sep 2018 14:34:59 -0500 Subject: [PATCH] Skip semi-colon test with findIf (#6584) * Skip semi-colon test with findIf * Fix #6186 * column cleanser --- tools/sqf_validator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/sqf_validator.py b/tools/sqf_validator.py index 4f145b5bd0..c45f0f94f2 100644 --- a/tools/sqf_validator.py +++ b/tools/sqf_validator.py @@ -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