[gedit-plugins] Enable static analysis in the GitLab CI and fix issues preventing flake8 to complete the analysis



commit 6d45017b79d070a7356fa99e556a6be1916be35d
Author: Jordi Mas <jmas softcatala org>
Date:   Sat May 18 05:35:59 2019 +0000

    Enable static analysis in the GitLab CI and fix issues preventing flake8 to complete the analysis

 .gitlab-ci.yml                                   | 17 +++++++++++++++++
 plugins/charmap/charmap/__init__.py              |  1 -
 plugins/codecomment/codecomment.py               |  1 -
 plugins/colorpicker/colorpicker.py               |  1 -
 plugins/colorschemer/schemer/__init__.py         |  2 +-
 plugins/commander/commander/commands/__init__.py |  3 +--
 plugins/commander/commander/windowactivatable.py |  1 -
 plugins/joinlines/joinlines.py                   |  1 -
 plugins/multiedit/multiedit/viewactivatable.py   |  1 -
 plugins/multiedit/multiedit/windowactivatable.py |  2 --
 plugins/synctex/synctex/evince_dbus.py           |  2 +-
 plugins/synctex/synctex/synctex.py               |  1 -
 plugins/terminal/terminal.py                     |  2 --
 plugins/textsize/textsize/__init__.py            |  1 -
 plugins/translate/translate/__init__.py          |  1 -
 plugins/translate/translate/preferences.py       |  3 +--
 16 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c3accc..782eaf3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,10 @@
 image: ubuntu:devel
 
+stages:
+    - build
+    - static_analysis
+
+
 build:
   stage: build
   before_script:
@@ -16,3 +21,15 @@ build:
     - meson _build
     - ninja -C _build dist
 
+static_analysis:
+  stage: build
+  before_script:
+    - export DEBIAN_FRONTEND=noninteractive
+    - apt-get update -y
+    - apt-get install python3 python3-pip python3-dbus  -y
+    - python3 -m pip install flake8
+
+  script:
+    - cd plugins
+    - flake8 --select=F --ignore=F401,F841
+
diff --git a/plugins/charmap/charmap/__init__.py b/plugins/charmap/charmap/__init__.py
index 3cb2600..60dd5d1 100644
--- a/plugins/charmap/charmap/__init__.py
+++ b/plugins/charmap/charmap/__init__.py
@@ -26,7 +26,6 @@ gi.require_version('Gtk', '3.0')
 gi.require_version('Gucharmap', '2.90')
 from gi.repository import GObject, Gio, Pango, Gtk, Gedit, Gucharmap
 from .panel import CharmapPanel
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/codecomment/codecomment.py b/plugins/codecomment/codecomment.py
index 8ca2038..72d38dd 100644
--- a/plugins/codecomment/codecomment.py
+++ b/plugins/codecomment/codecomment.py
@@ -25,7 +25,6 @@ import gi
 gi.require_version('Gtk', '3.0')
 gi.require_version('GtkSource', '4')
 from gi.repository import GObject, Gio, Gtk, GtkSource, Gedit
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/colorpicker/colorpicker.py b/plugins/colorpicker/colorpicker.py
index c585115..2e77849 100644
--- a/plugins/colorpicker/colorpicker.py
+++ b/plugins/colorpicker/colorpicker.py
@@ -25,7 +25,6 @@ gi.require_version('Gtk', '3.0')
 gi.require_version('Gedit', '3.0')
 from gi.repository import GObject, Gio, Gtk, Gdk, Gedit
 import re
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/colorschemer/schemer/__init__.py b/plugins/colorschemer/schemer/__init__.py
index cb3edf0..54addaa 100644
--- a/plugins/colorschemer/schemer/__init__.py
+++ b/plugins/colorschemer/schemer/__init__.py
@@ -55,5 +55,5 @@ class AppActivatable(GObject.Object, Gedit.AppActivatable):
     self.menu_ext = None
 
   def open_dialog(self, action, parameter, data=None):
-    schemer.GUI(Gedit.App, os.path.join(self.plugin_info.get_data_dir(), 'ui'))
+    GUI(Gedit.App, os.path.join(self.plugin_info.get_data_dir(), 'ui'))
 
diff --git a/plugins/commander/commander/commands/__init__.py 
b/plugins/commander/commander/commands/__init__.py
index 92112c4..e55399e 100644
--- a/plugins/commander/commander/commands/__init__.py
+++ b/plugins/commander/commander/commands/__init__.py
@@ -19,12 +19,11 @@
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor,
 #  Boston, MA 02110-1301, USA.
 
-import os
 from gi.repository import GLib, GObject, Gio
 
 import sys, bisect, types, shlex, re, os, traceback
 
-from . import module, method, result, exceptions, metamodule
+from . import module, method, result, exceptions, metamodule, completion
 
 from commands.accel_group import AccelGroup
 from commands.accel_group import Accelerator
diff --git a/plugins/commander/commander/windowactivatable.py 
b/plugins/commander/commander/windowactivatable.py
index 8b6d27f..5b63901 100644
--- a/plugins/commander/commander/windowactivatable.py
+++ b/plugins/commander/commander/windowactivatable.py
@@ -22,7 +22,6 @@
 from gi.repository import GLib, GObject, Gio, Gtk, Gedit
 from entry import Entry
 from info import Info
-from gpdefs import *
 
 class CommanderWindowActivatable(GObject.Object, Gedit.WindowActivatable):
 
diff --git a/plugins/joinlines/joinlines.py b/plugins/joinlines/joinlines.py
index 275d9e2..6b21c6c 100644
--- a/plugins/joinlines/joinlines.py
+++ b/plugins/joinlines/joinlines.py
@@ -20,7 +20,6 @@
 #  Boston, MA 02110-1301, USA.
 
 from gi.repository import GObject, Gio, Gtk, Gedit
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/multiedit/multiedit/viewactivatable.py b/plugins/multiedit/multiedit/viewactivatable.py
index 4f568ac..8a22fbd 100644
--- a/plugins/multiedit/multiedit/viewactivatable.py
+++ b/plugins/multiedit/multiedit/viewactivatable.py
@@ -26,7 +26,6 @@ import sys
 from gi.repository import GLib, GObject, Pango, PangoCairo, Gdk, Gtk, Gedit
 
 from .signals import Signals
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/multiedit/multiedit/windowactivatable.py 
b/plugins/multiedit/multiedit/windowactivatable.py
index a027bb0..24326e6 100644
--- a/plugins/multiedit/multiedit/windowactivatable.py
+++ b/plugins/multiedit/multiedit/windowactivatable.py
@@ -23,8 +23,6 @@ from gi.repository import GLib, GObject, Gio, Gedit
 
 from .viewactivatable import MultiEditViewActivatable
 
-from gpdefs import *
-
 
 class MultiEditWindowActivatable(GObject.Object, Gedit.WindowActivatable):
 
diff --git a/plugins/synctex/synctex/evince_dbus.py b/plugins/synctex/synctex/evince_dbus.py
index ba6aaea..d8b3978 100755
--- a/plugins/synctex/synctex/evince_dbus.py
+++ b/plugins/synctex/synctex/evince_dbus.py
@@ -19,7 +19,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 # Street, Fifth Floor, Boston, MA  02110-1301, USA
 
-import dbus, subprocess, time
+import dbus, subprocess
 
 RUNNING, CLOSED = range(2)
 
diff --git a/plugins/synctex/synctex/synctex.py b/plugins/synctex/synctex/synctex.py
index b6ddc7c..1badf51 100644
--- a/plugins/synctex/synctex/synctex.py
+++ b/plugins/synctex/synctex/synctex.py
@@ -26,7 +26,6 @@ import dbus.mainloop.glib
 import logging
 import os
 import re
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/terminal/terminal.py b/plugins/terminal/terminal.py
index 91886f1..5f7ebb1 100644
--- a/plugins/terminal/terminal.py
+++ b/plugins/terminal/terminal.py
@@ -28,8 +28,6 @@ gi.require_version('Gtk', '3.0')
 gi.require_version('Vte', '2.91')
 from gi.repository import GObject, GLib, Gio, Pango, Gdk, Gtk, Gedit, Vte
 
-from gpdefs import *
-
 try:
     import gettext
     gettext.bindtextdomain('gedit-plugins')
diff --git a/plugins/textsize/textsize/__init__.py b/plugins/textsize/textsize/__init__.py
index 594076e..2700783 100644
--- a/plugins/textsize/textsize/__init__.py
+++ b/plugins/textsize/textsize/__init__.py
@@ -27,7 +27,6 @@ gi.require_version('Gtk', '3.0')
 gi.require_version('Gedit', '3.0')
 from gi.repository import GObject, Gio, Gtk, Gdk, Gedit
 from .viewactivatable import TextSizeViewActivatable
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/translate/translate/__init__.py b/plugins/translate/translate/__init__.py
index 394d724..e7fe0ef 100644
--- a/plugins/translate/translate/__init__.py
+++ b/plugins/translate/translate/__init__.py
@@ -28,7 +28,6 @@ from .services.apertium import Apertium
 from .translateview import TranslateView
 from .preferences import Preferences
 from .settings import Settings
-from gpdefs import *
 
 try:
     import gettext
diff --git a/plugins/translate/translate/preferences.py b/plugins/translate/translate/preferences.py
index 66d0aca..2101239 100644
--- a/plugins/translate/translate/preferences.py
+++ b/plugins/translate/translate/preferences.py
@@ -19,8 +19,7 @@
 
 import os
 from gi.repository import Gio, Gtk
-import gettext
-from gpdefs import *
+from gpdefs import GETTEXT_PACKAGE
 from .services.services import Services
 from .settings import Settings
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]