src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Async/AsyncChecker.py

branch
eric7
changeset 11142
2f0fb22c1d63
parent 11090
f5f5f5803935
child 11145
d328a7b74fd8
equal deleted inserted replaced
11141:2f5f73c51c7c 11142:2f0fb22c1d63
22 "ASY102", 22 "ASY102",
23 "ASY103", 23 "ASY103",
24 "ASY104", 24 "ASY104",
25 "ASY105", 25 "ASY105",
26 ] 26 ]
27 Prefix = "ASY"
27 28
28 def __init__(self, source, filename, tree, select, ignore, expected, repeat, args): 29 def __init__(self, source, filename, tree, select, ignore, expected, repeat, args):
29 """ 30 """
30 Constructor 31 Constructor
31 32
44 @param repeat flag indicating to report each occurrence of a code 45 @param repeat flag indicating to report each occurrence of a code
45 @type bool 46 @type bool
46 @param args dictionary of arguments for the various checks 47 @param args dictionary of arguments for the various checks
47 @type dict 48 @type dict
48 """ 49 """
49 self.__select = tuple(select) 50 self.__select = tuple(x for x in select if x.startswith(AsyncChecker.Prefix))
50 self.__ignore = ( 51 self.__ignore = tuple(x for x in ignore if x.startswith(AsyncChecker.Prefix))
51 ("",) if select else tuple(x for x in ignore if x.startswith("ASY"))
52 )
53 self.__expected = expected[:] 52 self.__expected = expected[:]
54 self.__repeat = repeat 53 self.__repeat = repeat
55 self.__filename = filename 54 self.__filename = filename
56 self.__source = source[:] 55 self.__source = source[:]
57 self.__tree = copy.deepcopy(tree) 56 self.__tree = copy.deepcopy(tree)
82 @param code message code to check for 81 @param code message code to check for
83 @type str 82 @type str
84 @return flag indicating to ignore the given code 83 @return flag indicating to ignore the given code
85 @rtype bool 84 @rtype bool
86 """ 85 """
87 return code.startswith(self.__ignore) and not code.startswith(self.__select) 86 return (
87 code in self.__ignore
88 or (code.startswith(self.__ignore) and not code.startswith(self.__select))
89 )
88 90
89 def __error(self, lineNumber, offset, code, *args): 91 def __error(self, lineNumber, offset, code, *args):
90 """ 92 """
91 Private method to record an issue. 93 Private method to record an issue.
92 94

eric ide

mercurial