@@ -997,6 +997,7 @@ class Suppression:
997997 errorId The id string of the error to suppress, can be a wildcard
998998 fileName The name of the file to suppress warnings for, can include wildcards
999999 lineNumber The number of the line to suppress warnings from, can be 0 to represent any line
1000+ thisAndNextLine Set if the line after lineNumber is suppressed too
10001001 symbolName The name of the symbol to match warnings for, can include wildcards
10011002 lineBegin The first line to suppress warnings from
10021003 lineEnd The last line to suppress warnings from
@@ -1006,6 +1007,7 @@ class Suppression:
10061007 errorId = None
10071008 fileName = None
10081009 lineNumber = None
1010+ thisAndNextLine = None
10091011 symbolName = None
10101012 lineBegin = None
10111013 lineEnd = None
@@ -1015,13 +1017,14 @@ def __init__(self, element):
10151017 self .errorId = element .get ('errorId' )
10161018 self .fileName = element .get ('fileName' )
10171019 self .lineNumber = element .get ('lineNumber' )
1020+ self .thisAndNextLine = element .get ('thisAndNextLine' )
10181021 self .symbolName = element .get ('symbolName' )
10191022 self .lineBegin = element .get ('lineBegin' )
10201023 self .lineEnd = element .get ('lineEnd' )
10211024 self .suppressionType = element .get ('type' )
10221025
10231026 def __repr__ (self ):
1024- attrs = ["errorId" , "fileName" , "lineNumber" , "symbolName" , "lineBegin" , "lineEnd" ,"suppressionType" ]
1027+ attrs = ["errorId" , "fileName" , "lineNumber" , "thisAndNextLine" , " symbolName" , "lineBegin" , "lineEnd" ,"suppressionType" ]
10251028 return "{}({})" .format (
10261029 "Suppression" ,
10271030 ", " .join (("{}={}" .format (a , repr (getattr (self , a ))) for a in attrs ))
@@ -1031,7 +1034,7 @@ def isMatch(self, file, line, message, errorId):
10311034 # Line Suppression
10321035 if ((self .fileName is None or fnmatch (file , self .fileName ))
10331036 and (self .suppressionType is None ) # Verify use of default suppression type (None = unique)
1034- and (self .lineNumber is not None and int (line ) == int (self .lineNumber ))
1037+ and (self .lineNumber is not None and ( int (line ) == int (self .lineNumber ) or ( self . thisAndNextLine and int ( line ) == int ( self . lineNumber ) + 1 ) ))
10351038 and (self .symbolName is None or fnmatch (message , '*' + self .symbolName + '*' ))
10361039 and fnmatch (errorId , self .errorId )):
10371040 return True
@@ -1052,6 +1055,7 @@ def isMatch(self, file, line, message, errorId):
10521055 # Other Suppression (Globally set via suppression file or cli command)
10531056 if ((self .fileName is None or fnmatch (file , self .fileName ))
10541057 and (self .suppressionType is None )
1058+ and (self .lineNumber is None )
10551059 and (self .symbolName is None or fnmatch (message , '*' + self .symbolName + '*' ))
10561060 and fnmatch (errorId , self .errorId )):
10571061 return True
0 commit comments