PluginVulture.py

branch
eric7
changeset 116
81d24da85ac5
parent 111
e7ef1a3de3ca
child 119
6b7a48ea6e66
equal deleted inserted replaced
115:5a1b7f9dcbe5 116:81d24da85ac5
12 from PyQt6.QtCore import QObject, QTranslator, pyqtSignal 12 from PyQt6.QtCore import QObject, QTranslator, pyqtSignal
13 13
14 from eric7 import Preferences 14 from eric7 import Preferences
15 from eric7.EricGui.EricAction import EricAction 15 from eric7.EricGui.EricAction import EricAction
16 from eric7.EricWidgets.EricApplication import ericApp 16 from eric7.EricWidgets.EricApplication import ericApp
17
18 try:
19 from eric7.SystemUtilities.PythonUtilities import determinePythonVersion
20 except ImportError:
21 # imports for eric < 23.1
22 from eric7.Utilities import determinePythonVersion
23 17
24 # Start-Of-Header 18 # Start-Of-Header
25 name = "Unused Code Checker Plug-in" 19 name = "Unused Code Checker Plug-in"
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 20 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
27 autoactivate = True 21 autoactivate = True
28 deactivateable = True 22 deactivateable = True
29 version = "10.3.1" 23 version = "10.3.2"
30 className = "VulturePlugin" 24 className = "VulturePlugin"
31 packageName = "VultureChecker" 25 packageName = "VultureChecker"
32 shortDescription = "Plug-in to detect unused code using the 'vulture' library" 26 shortDescription = "Plug-in to detect unused code using the 'vulture' library"
33 longDescription = """Plug-in to detect unused code using the 'vulture' library.""" 27 longDescription = """Plug-in to detect unused code using the 'vulture' library."""
34 needsRestart = False 28 needsRestart = False
29 hasCompiledForms = True
35 pyqtApi = 2 30 pyqtApi = 2
36 # End-Of-Header 31 # End-Of-Header
37 32
38 error = "" 33 error = ""
39 34
159 @type str 154 @type str
160 @param source string containing the code 155 @param source string containing the code
161 @type str 156 @type str
162 """ 157 """
163 if lang is None: 158 if lang is None:
164 lang = "Python{0}".format(determinePythonVersion(filename, source)) 159 lang = "Python3"
165 if lang != "Python3": 160 if lang != "Python3":
166 return 161 return
167 162
168 self.backgroundService.enqueueRequest("vulture", lang, filename, [source]) 163 self.backgroundService.enqueueRequest("vulture", lang, filename, [source])
169 164
178 """ 173 """
179 data = { 174 data = {
180 "Python3": [], 175 "Python3": [],
181 } 176 }
182 for filename, source in argumentsList: 177 for filename, source in argumentsList:
183 lang = "Python{0}".format(determinePythonVersion(filename, source)) 178 data["Python3"].append((filename, source))
184 if lang != "Python3":
185 continue
186 else:
187 data[lang].append((filename, source))
188 179
189 self.queuedBatches = [] 180 self.queuedBatches = []
190 if data["Python3"]: 181 if data["Python3"]:
191 self.queuedBatches.append("Python3") 182 self.queuedBatches.append("Python3")
192 self.backgroundService.enqueueRequest( 183 self.backgroundService.enqueueRequest(

eric ide

mercurial