diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c04554b675513aa39bdc8fc0b820abbc8dfb7dc..323fa631fc005cedde43f55295e7962254efb400 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,16 @@ linter_shell: script: - ./.linter_shell.sh +linter_javascript: + stage: lint + tags: + - ubuntu + - regular + script: + - apt-get update && apt-get install -y nodejs npm nodejs-legacy + - npm install -g jshint + - jshint package/ + build: stage: build artifacts: diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000000000000000000000000000000000000..1bb8e137784120c9aa840a02938fcc2e92e93a3d --- /dev/null +++ b/.jshintrc @@ -0,0 +1,4 @@ +{ + "esversion": 6, + "laxbreak": true +} diff --git a/package/le-edubar@c3sl.ufpr.br/constants.js b/package/le-edubar@c3sl.ufpr.br/constants.js index a04ca147e5bf60dbde2076c35438aa9a539a868d..c316434aa1cb2ab9612996977daf2b7c99d3f0ee 100644 --- a/package/le-edubar@c3sl.ufpr.br/constants.js +++ b/package/le-edubar@c3sl.ufpr.br/constants.js @@ -53,7 +53,7 @@ const DOWNLOAD_PATH = "/var/cache/le-edubar/"; /*TAGS*/ const URL_SUBJECTS = "https://api.portalmec.c3sl.ufpr.br/v1/subjects"; const URL_EDUCATIONAL_STAGES = "https://api.portalmec.c3sl.ufpr.br/v1/educational_stages"; -const URL_OBJECT_TYPES = "https://api.portalmec.c3sl.ufpr.br/v1/object_types" +const URL_OBJECT_TYPES = "https://api.portalmec.c3sl.ufpr.br/v1/object_types"; const ICON_THUMBNAIL = { /*DEFAULT*/ diff --git a/package/le-edubar@c3sl.ufpr.br/edubus.js b/package/le-edubar@c3sl.ufpr.br/edubus.js index a2eb9e2c9d6a9ab159d501484f4e8f36402e08ff..86b8d8581414788d9ed351272f5dbaf8a3cad98a 100644 --- a/package/le-edubar@c3sl.ufpr.br/edubus.js +++ b/package/le-edubar@c3sl.ufpr.br/edubus.js @@ -22,16 +22,16 @@ const Gio = imports.gi.Gio; -const download_interface = '<node>\ - <interface name="br.ufpr.c3sl.edubar.Download">\ - <method name="Start">\ - <arg type="s" direction="in"/>\ - <arg type="s" direction="in"/>\ - <arg type="s" direction="in"/>\ - <arg type="b" direction="out" />\ - </method>\ - </interface>\ -</node>'; +const download_interface = '<node>'+ +' <interface name="br.ufpr.c3sl.edubar.Download">'+ +' <method name="Start">'+ +' <arg type="s" direction="in"/>'+ +' <arg type="s" direction="in"/>'+ +' <arg type="s" direction="in"/>'+ +' <arg type="b" direction="out" />'+ +' </method>'+ +' </interface>'+ +'</node>'; var iface_download = Gio.DBusProxy.makeProxyWrapper(download_interface); var download = iface_download(Gio.DBus.system,"br.ufpr.c3sl.edubar","/br/ufpr/c3sl/edubar"); @@ -40,27 +40,27 @@ var download = iface_download(Gio.DBus.system,"br.ufpr.c3sl.edubar","/br/ufpr/c3 * DBUS functions returns an Array. That's why you must use Method()[0] * to get the first output sometimes. */ -const file_interface = '<node>\ - <interface name="br.ufpr.c3sl.edubar.File">\ - <method name="Exists">\ - <arg type="s" direction="in"/>\ - <arg type="b" direction="out" />\ - </method>\ - <method name="Size">\ - <arg type="s" direction="in"/>\ - <arg type="d" direction="out" />\ - </method>\ - <method name="GetLocalFiles">\ - <arg type="i" direction="in"/>\ - <arg type="s" direction="in"/>\ - <arg type="s" direction="in"/>\ - <arg type="av" direction="out" />\ - </method>\ - <method name="GetTotalFiles">\ - <arg type="d" direction="out" />\ - </method>\ - </interface>\ -</node>'; +const file_interface = '<node>'+ +' <interface name="br.ufpr.c3sl.edubar.File">'+ +' <method name="Exists">'+ +' <arg type="s" direction="in"/>'+ +' <arg type="b" direction="out" />'+ +' </method>'+ +' <method name="Size">'+ +' <arg type="s" direction="in"/>'+ +' <arg type="d" direction="out" />'+ +' </method>'+ +' <method name="GetLocalFiles">'+ +' <arg type="i" direction="in"/>'+ +' <arg type="s" direction="in"/>'+ +' <arg type="s" direction="in"/>'+ +' <arg type="av" direction="out" />'+ +' </method>'+ +' <method name="GetTotalFiles">'+ +' <arg type="d" direction="out" />'+ +' </method>'+ +' </interface>'+ +'</node>'; var iface_file = Gio.DBusProxy.makeProxyWrapper(file_interface); -var file = iface_file(Gio.DBus.system,"br.ufpr.c3sl.edubar","/br/ufpr/c3sl/edubar"); \ No newline at end of file +var file = iface_file(Gio.DBus.system,"br.ufpr.c3sl.edubar","/br/ufpr/c3sl/edubar"); diff --git a/package/le-edubar@c3sl.ufpr.br/extension.js b/package/le-edubar@c3sl.ufpr.br/extension.js index 0f602a49a3e55887136b91d015b22dd99a0d0919..f1e667961ef1436d1ef342a4d03c4a0934378820 100644 --- a/package/le-edubar@c3sl.ufpr.br/extension.js +++ b/package/le-edubar@c3sl.ufpr.br/extension.js @@ -79,7 +79,7 @@ function check_searching() { /* Create a Soup Session connection*/ function create_soup_session() { - soup_result = new Array(); + soup_result = []; if (soup_session != null) { return; } @@ -197,7 +197,7 @@ function send_soup_request (request_message, searching_text, local_text) { if (message.status_code !== 200) { searching_text.text = 'Sem resposta do servidor.'; - on_going_downloads = new Array(); + on_going_downloads = []; return; } @@ -811,7 +811,7 @@ function create_result(edu_object) { style_class: 'result-title', })); - make_text_justify(result.get_last_child().clutter_text) + make_text_justify(result.get_last_child().clutter_text); result.add_actor(create_info_box(edu_object)); @@ -875,7 +875,7 @@ function create_result(edu_object) { id : edu_object.id.toString(), name : edu_name[0], size : edu_object.attachments[edu_id].size, - } + }; button_group.add_actor(result_button(learning_content)); } @@ -1144,7 +1144,7 @@ var toggle_overview = { Constants.update_result_size(); if (Overview.viewSelector._isActivated()) { - Overview.viewSelector._searchCancelled() + Overview.viewSelector._searchCancelled(); } Main.overview._controls._group.get_last_child().opacity = 0; Overview._dash.actor.hide(); @@ -1188,7 +1188,7 @@ var toggle_overview = { portal_button.remove(); } }, -} +}; /*Portal MEC button*/ var portal_button = { @@ -1225,7 +1225,7 @@ var portal_button = { this.edubutton.hide(); Panel._rightBox.remove_child(this.edubutton); }, -} +}; /*Portal MEC search box * input_edu.entry = Search Box @@ -1316,7 +1316,7 @@ var input_edu = { set_text: function (new_text) { this.entry.text = new_text; } -} +}; /*Extension Main()*/ function init(extensionMeta) { @@ -1324,7 +1324,7 @@ function init(extensionMeta) { meta_path = extensionMeta.path; theme.append_search_path(meta_path + "/icons/portal"); theme.append_search_path(meta_path + "/icons/FlatRemix"); - on_going_downloads = new Array(); + on_going_downloads = []; input_edu.create(); portal_button.create(); } diff --git a/package/le-edubar@c3sl.ufpr.br/prefabs.js b/package/le-edubar@c3sl.ufpr.br/prefabs.js index c109f3727d080c7132c81dfb7760ee5385f56f94..4afbf96aa251bb45a971f140e9f56a37618917dd 100644 --- a/package/le-edubar@c3sl.ufpr.br/prefabs.js +++ b/package/le-edubar@c3sl.ufpr.br/prefabs.js @@ -96,7 +96,7 @@ function FilterTag (name,api_name) { } else { this.next.add_filter(name,api_name); } - } + }; } /*Search Filter is a class of a group of filter choices, like order by*/ @@ -111,6 +111,6 @@ function SearchFilter (title,type){ } else { this.next.add_filter(name,api_name); } - } + }; }