From a59bb45bb6e86133b7005e8596fe9bbaee06c13e Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 11 Jun 2024 15:20:57 +0200 Subject: [PATCH] fixed `singleton-comparison` pylint warnings --- addons/cppcheckdata.py | 12 ++++++------ addons/misc.py | 2 +- addons/namingng.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 2de7a3512e3..5340e3d5ade 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -978,22 +978,22 @@ def __repr__(self): def isMatch(self, file, line, message, errorId): # Line Suppression if ((self.fileName is None or fnmatch(file, self.fileName)) - and (self.suppressionType == None) # Verify use of default suppression type (None = unique) - and (self.lineNumber != None and int(line) == int(self.lineNumber)) + and (self.suppressionType is None) # Verify use of default suppression type (None = unique) + and (self.lineNumber is not None and int(line) == int(self.lineNumber)) and (self.symbolName is None or fnmatch(message, '*'+self.symbolName+'*')) and fnmatch(errorId, self.errorId)): return True # File Suppression if ((self.fileName is None or fnmatch(file, self.fileName)) - and (self.suppressionType != None and self.suppressionType == "file") # Verify use of file (global) suppression type + and (self.suppressionType is not None and self.suppressionType == "file") # Verify use of file (global) suppression type and (self.symbolName is None or fnmatch(message, '*'+self.symbolName+'*')) and fnmatch(errorId, self.errorId)): return True # Block Suppression Mode if ((self.fileName is None or fnmatch(file, self.fileName)) - and (self.suppressionType != None and self.suppressionType == "block") # Type for Block suppression - and (self.lineBegin != None and int(line) > int(self.lineBegin)) # Code Match is between the Block suppression - and (self.lineEnd != None and int(line) < int(self.lineEnd)) # Code Match is between the Block suppression + and (self.suppressionType is not None and self.suppressionType == "block") # Type for Block suppression + and (self.lineBegin is not None and int(line) > int(self.lineBegin)) # Code Match is between the Block suppression + and (self.lineEnd is not None and int(line) < int(self.lineEnd)) # Code Match is between the Block suppression and (self.symbolName is None or fnmatch(message, '*'+self.symbolName+'*')) and fnmatch(errorId, self.errorId)): return True diff --git a/addons/misc.py b/addons/misc.py index 15a742c28f9..670d6152ff5 100644 --- a/addons/misc.py +++ b/addons/misc.py @@ -16,7 +16,7 @@ VERIFY_ACTUAL = [] def reportError(token, severity, msg, id): - if id == 'debug' and DEBUG == False: + if id == 'debug' and not DEBUG: return if VERIFY: VERIFY_ACTUAL.append(str(token.linenr) + ':' + id) diff --git a/addons/namingng.py b/addons/namingng.py index a0e18fcc032..9da177321ef 100755 --- a/addons/namingng.py +++ b/addons/namingng.py @@ -242,7 +242,7 @@ def report_pending_ifndef(directive,column): phase = -1 continue guard_name,guard_column = check_include_guard_name(conf,directive) - if guard_name == None: + if guard_name is None: phase = -1 continue pending_ifndef = directive