11 import textwrap |
11 import textwrap |
12 import contextlib |
12 import contextlib |
13 |
13 |
14 from PyQt6.QtCore import QObject, pyqtSignal, QCoreApplication |
14 from PyQt6.QtCore import QObject, pyqtSignal, QCoreApplication |
15 |
15 |
16 from EricWidgets.EricApplication import ericApp |
16 from eric7.EricWidgets.EricApplication import ericApp |
17 from EricGui.EricAction import EricAction |
17 from eric7.EricGui.EricAction import EricAction |
18 from Project.ProjectBrowserModel import ProjectBrowserFileItem |
18 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem |
19 from Utilities import determinePythonVersion |
19 from eric7.Utilities import determinePythonVersion |
20 |
20 |
21 import Preferences |
21 from eric7 import Preferences |
22 import UI.Info |
22 from eric7.UI import Info |
23 |
23 |
24 # Start-Of-Header |
24 # Start-Of-Header |
25 name = "Code Style Checker Plugin" |
25 name = "Code Style Checker Plugin" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
27 autoactivate = True |
27 autoactivate = True |
28 deactivateable = True |
28 deactivateable = True |
29 version = UI.Info.VersionOnly |
29 version = Info.VersionOnly |
30 className = "CodeStyleCheckerPlugin" |
30 className = "CodeStyleCheckerPlugin" |
31 packageName = "__core__" |
31 packageName = "__core__" |
32 shortDescription = "Show the Python Code Style Checker dialog." |
32 shortDescription = "Show the Python Code Style Checker dialog." |
33 longDescription = ( |
33 longDescription = ( |
34 """This plugin implements the Python Code Style""" |
34 """This plugin implements the Python Code Style""" |
214 @type dict |
214 @type dict |
215 @param results dictionary containing the check result data |
215 @param results dictionary containing the check result data |
216 (see CodesStyleChecker.__checkCodeStyle for details) |
216 (see CodesStyleChecker.__checkCodeStyle for details) |
217 @type dict |
217 @type dict |
218 """ |
218 """ |
219 from CheckerPlugins.CodeStyleChecker.translations import getTranslatedMessage |
219 from eric7.Plugins.CheckerPlugins.CodeStyleChecker.translations import ( |
|
220 getTranslatedMessage, |
|
221 ) |
220 |
222 |
221 fixes = 0 |
223 fixes = 0 |
222 for result in results: |
224 for result in results: |
223 msg = getTranslatedMessage(result["code"], result["args"]) |
225 msg = getTranslatedMessage(result["code"], result["args"]) |
224 |
226 |
374 os.path.join(ppath, file) |
376 os.path.join(ppath, file) |
375 for file in project.pdata["SOURCES"] |
377 for file in project.pdata["SOURCES"] |
376 if file.endswith(tuple(Preferences.getPython("Python3Extensions"))) |
378 if file.endswith(tuple(Preferences.getPython("Python3Extensions"))) |
377 ] |
379 ] |
378 |
380 |
379 from CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
381 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
380 |
382 |
381 self.__projectCodeStyleCheckerDialog = ( |
383 self.__projectCodeStyleCheckerDialog = ( |
382 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
384 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
383 ) |
385 ) |
384 self.__projectCodeStyleCheckerDialog.show() |
386 self.__projectCodeStyleCheckerDialog.show() |
402 isDir = False |
404 isDir = False |
403 except AttributeError: |
405 except AttributeError: |
404 fn = itm.dirName() |
406 fn = itm.dirName() |
405 isDir = True |
407 isDir = True |
406 |
408 |
407 from CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
409 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
408 |
410 |
409 self.__projectBrowserCodeStyleCheckerDialog = ( |
411 self.__projectBrowserCodeStyleCheckerDialog = ( |
410 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
412 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
411 ) |
413 ) |
412 self.__projectBrowserCodeStyleCheckerDialog.show() |
414 self.__projectBrowserCodeStyleCheckerDialog.show() |
461 if ( |
463 if ( |
462 editor is not None |
464 editor is not None |
463 and editor.checkDirty() |
465 and editor.checkDirty() |
464 and editor.getFileName() is not None |
466 and editor.getFileName() is not None |
465 ): |
467 ): |
466 from CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
468 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import ( |
|
469 CodeStyleCheckerDialog, |
|
470 ) |
467 |
471 |
468 self.__editorCodeStyleCheckerDialog = ( |
472 self.__editorCodeStyleCheckerDialog = ( |
469 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
473 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
470 ) |
474 ) |
471 self.__editorCodeStyleCheckerDialog.show() |
475 self.__editorCodeStyleCheckerDialog.show() |