From a696c2d76e6f3e6875dc3f666f3eab2d3ebb9627 Mon Sep 17 00:00:00 2001 From: louisjdmartin Date: Tue, 18 Jun 2019 15:12:15 +0200 Subject: [PATCH 01/15] Update gitignore for JetBrains IDE and remove useless files --- .gitignore | 73 ++++++++++++++++++- .idea/compiler.xml | 16 ---- .idea/encodings.xml | 6 -- .../Maven__com_google_guava_guava_18_0.xml | 13 ---- ...le_protobuf_protobuf_java_3_0_0_beta_2.xml | 13 ---- ...oglecode_json_simple_json_simple_1_1_1.xml | 13 ---- .../Maven__commons_io_commons_io_2_4.xml | 13 ---- .../Maven__commons_lang_commons_lang_2_6.xml | 13 ---- ...Maven__javax_xml_stream_stax_api_1_0_2.xml | 13 ---- .idea/libraries/Maven__jaxen_jaxen_1_1_4.xml | 13 ---- .idea/libraries/Maven__junit_junit_4_11.xml | 13 ---- ...rg_codehaus_sonar_sslr_sslr_xpath_1_20.xml | 13 ---- ...__org_codehaus_staxmate_staxmate_2_0_1.xml | 13 ---- ..._org_codehaus_woodstox_stax2_api_3_1_4.xml | 13 ---- ...haus_woodstox_woodstox_core_lgpl_4_4_0.xml | 13 ---- .../Maven__org_hamcrest_hamcrest_core_1_3.xml | 13 ---- .../Maven__org_slf4j_jcl_over_slf4j_1_5_6.xml | 13 ---- .../Maven__org_slf4j_slf4j_api_1_5_6.xml | 13 ---- ...r_squid_bridge_sslr_squid_bridge_2_6_1.xml | 13 ---- .idea/misc.xml | 67 ----------------- .idea/modules.xml | 8 -- .idea/vcs.xml | 6 -- 22 files changed, 71 insertions(+), 313 deletions(-) delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/libraries/Maven__com_google_guava_guava_18_0.xml delete mode 100644 .idea/libraries/Maven__com_google_protobuf_protobuf_java_3_0_0_beta_2.xml delete mode 100644 .idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml delete mode 100644 .idea/libraries/Maven__commons_io_commons_io_2_4.xml delete mode 100644 .idea/libraries/Maven__commons_lang_commons_lang_2_6.xml delete mode 100644 .idea/libraries/Maven__javax_xml_stream_stax_api_1_0_2.xml delete mode 100644 .idea/libraries/Maven__jaxen_jaxen_1_1_4.xml delete mode 100644 .idea/libraries/Maven__junit_junit_4_11.xml delete mode 100644 .idea/libraries/Maven__org_codehaus_sonar_sslr_sslr_xpath_1_20.xml delete mode 100644 .idea/libraries/Maven__org_codehaus_staxmate_staxmate_2_0_1.xml delete mode 100644 .idea/libraries/Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml delete mode 100644 .idea/libraries/Maven__org_codehaus_woodstox_woodstox_core_lgpl_4_4_0.xml delete mode 100644 .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml delete mode 100644 .idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_5_6.xml delete mode 100644 .idea/libraries/Maven__org_slf4j_slf4j_api_1_5_6.xml delete mode 100644 .idea/libraries/Maven__org_sonarsource_sslr_squid_bridge_sslr_squid_bridge_2_6_1.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index c507849..7e431a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,71 @@ -target -.idea +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +.idea/modules.xml +.idea/*.iml +.idea/modules +*.iml +*.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +.idea/* +*.iml \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b194ae1..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index b26911b..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_guava_18_0.xml b/.idea/libraries/Maven__com_google_guava_guava_18_0.xml deleted file mode 100644 index bbd71d7..0000000 --- a/.idea/libraries/Maven__com_google_guava_guava_18_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_0_0_beta_2.xml b/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_0_0_beta_2.xml deleted file mode 100644 index 0370413..0000000 --- a/.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_0_0_beta_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml deleted file mode 100644 index f3f3738..0000000 --- a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_io_commons_io_2_4.xml b/.idea/libraries/Maven__commons_io_commons_io_2_4.xml deleted file mode 100644 index bc2aad0..0000000 --- a/.idea/libraries/Maven__commons_io_commons_io_2_4.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml deleted file mode 100644 index 2ec8376..0000000 --- a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_xml_stream_stax_api_1_0_2.xml b/.idea/libraries/Maven__javax_xml_stream_stax_api_1_0_2.xml deleted file mode 100644 index 2a4dd7a..0000000 --- a/.idea/libraries/Maven__javax_xml_stream_stax_api_1_0_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__jaxen_jaxen_1_1_4.xml b/.idea/libraries/Maven__jaxen_jaxen_1_1_4.xml deleted file mode 100644 index d84dbcf..0000000 --- a/.idea/libraries/Maven__jaxen_jaxen_1_1_4.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_11.xml b/.idea/libraries/Maven__junit_junit_4_11.xml deleted file mode 100644 index f33320d..0000000 --- a/.idea/libraries/Maven__junit_junit_4_11.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_codehaus_sonar_sslr_sslr_xpath_1_20.xml b/.idea/libraries/Maven__org_codehaus_sonar_sslr_sslr_xpath_1_20.xml deleted file mode 100644 index 40137b0..0000000 --- a/.idea/libraries/Maven__org_codehaus_sonar_sslr_sslr_xpath_1_20.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_codehaus_staxmate_staxmate_2_0_1.xml b/.idea/libraries/Maven__org_codehaus_staxmate_staxmate_2_0_1.xml deleted file mode 100644 index cd58567..0000000 --- a/.idea/libraries/Maven__org_codehaus_staxmate_staxmate_2_0_1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml b/.idea/libraries/Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml deleted file mode 100644 index b510642..0000000 --- a/.idea/libraries/Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_codehaus_woodstox_woodstox_core_lgpl_4_4_0.xml b/.idea/libraries/Maven__org_codehaus_woodstox_woodstox_core_lgpl_4_4_0.xml deleted file mode 100644 index c5ded28..0000000 --- a/.idea/libraries/Maven__org_codehaus_woodstox_woodstox_core_lgpl_4_4_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml deleted file mode 100644 index f58bbc1..0000000 --- a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_5_6.xml b/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_5_6.xml deleted file mode 100644 index 3b3e1bf..0000000 --- a/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_5_6.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_6.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_6.xml deleted file mode 100644 index b92b869..0000000 --- a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_6.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__org_sonarsource_sslr_squid_bridge_sslr_squid_bridge_2_6_1.xml b/.idea/libraries/Maven__org_sonarsource_sslr_squid_bridge_sslr_squid_bridge_2_6_1.xml deleted file mode 100644 index 9065ab6..0000000 --- a/.idea/libraries/Maven__org_sonarsource_sslr_squid_bridge_sslr_squid_bridge_2_6_1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index df553a4..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.8 - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index a53c384..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 100ea95e9f8b7c338845f9888de0004d621d647c Mon Sep 17 00:00:00 2001 From: louisjdmartin Date: Tue, 18 Jun 2019 15:53:18 +0200 Subject: [PATCH 02/15] Updating JDK fro travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fe69d0c..4c2e5c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ addons: organization: "lequal" jdk: - - oraclejdk8 + - openjdk8 script: - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar From 406df043e9bd2a6d2e6203dc7991eabdcc673aaa Mon Sep 17 00:00:00 2001 From: louisjdmartin Date: Wed, 19 Jun 2019 08:51:46 +0200 Subject: [PATCH 03/15] Updating string.properties --- src/main/resources/strings.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/strings.properties b/src/main/resources/strings.properties index 791cf0f..822cfc8 100644 --- a/src/main/resources/strings.properties +++ b/src/main/resources/strings.properties @@ -197,7 +197,7 @@ property.definition.report.path.key=sonar.report.path property.definition.report.path.name=Reports extension file property.definition.report.path.api.key=report_path property.definition.report.path.desc=Sonar CNES Report extension executable. (.jar) -property.definition.report.path.default=/opt/sonar/extensions/cnes/cnesreport.jar +property.definition.report.path.default=/opt/sonar/extensions/plugins/cnesreport.jar # Definition of value for the SonarQube's timeout property definition property.definition.pylintrc.key=sonar.pylintrc.path From bd56eb4c45d10b7d550fb9d8b2fe770bfbb7b75c Mon Sep 17 00:00:00 2001 From: louisjdmartin Date: Wed, 19 Jun 2019 10:17:46 +0200 Subject: [PATCH 04/15] Removing cnes report web page from cnes-scan to use the one from cnes-report plugin --- .gitignore | 4 +- .../scan/web/CnesPluginPageDefinition.java | 10 - src/main/resources/static/reporting.js | 185 ------------------ .../tests/CnesPluginPageDefinitionTest.java | 2 +- 4 files changed, 4 insertions(+), 197 deletions(-) delete mode 100644 src/main/resources/static/reporting.js diff --git a/.gitignore b/.gitignore index 7e431a9..eb0d60a 100644 --- a/.gitignore +++ b/.gitignore @@ -68,4 +68,6 @@ fabric.properties .idea/caches/build_file_checksums.ser .idea/* -*.iml \ No newline at end of file +*.iml + +target/ \ No newline at end of file diff --git a/src/main/java/fr/cnes/sonar/plugins/scan/web/CnesPluginPageDefinition.java b/src/main/java/fr/cnes/sonar/plugins/scan/web/CnesPluginPageDefinition.java index a3ce62e..3c567a8 100644 --- a/src/main/java/fr/cnes/sonar/plugins/scan/web/CnesPluginPageDefinition.java +++ b/src/main/java/fr/cnes/sonar/plugins/scan/web/CnesPluginPageDefinition.java @@ -46,16 +46,6 @@ public void define(final Context context) { context.addPage(page.build()); - // create a page - page = Page.builder(StringManager.string(StringManager.CNES_PAGE_REPORT_KEY)); - // set its name - page.setName(StringManager.string(StringManager.CNES_PAGE_REPORT_NAME)); - // set its scope (where it is displayed) - page.setScope(Scope.GLOBAL); - // add a new page for reporting - context.addPage(page.build()); - - // create a page page = Page.builder(StringManager.string(StringManager.CNES_PAGE_HELP_KEY)); // set its name diff --git a/src/main/resources/static/reporting.js b/src/main/resources/static/reporting.js deleted file mode 100644 index b20397a..0000000 --- a/src/main/resources/static/reporting.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - * This file is part of cnesscan. - * - * cnesscan is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * cnesscan is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with cnesscan. If not, see . - */ - -window.registerExtension('cnesscan/reporting', function (options) { - // let's create a flag telling if the page is still displayed - var isDisplayedReporting = true; - - /** - * Log information in the bottom text area - * @param string Text to log - */ - var log = function (string) { - // get the logging element - var logging = document.querySelector('#logging'); - // append text to log - logging.innerHTML = logging.innerHTML + "\n" + string; - // scroll to bottom - logging.scrollTop = logging.scrollHeight; - }; - - /** - * Verify that the fields are correct. - * @returns {boolean} true if all is good - */ - var checkForm = function () { - // check the field key - // get it - var key = document.forms["generation-form"]["key"].value; - // check if void - if (key === "") { - // log error - log("Key must be filled out."); - // abort the process - return false; - } - - return true; - }; - - /** - * Clear log information in text area - */ - var clearLog = function () { - // get the logging element - var logging = document.querySelector('#logging'); - // set initial text to log - logging.innerHTML = "## Logging console ##"; - }; - - /** - * Lock or unlock the form - * @param isEnabled true to unlock, false to lock the form - */ - var setEnabled = function (isEnabled) { - // retrieve the form - var form = document.getElementById("generation-form"); - // get all the components of the form - var elements = form.elements; - // change all components readOnly field to (un)lock them - for (var i = 0, len = elements.length; i < len; i++) { - elements[i].readOnly = !isEnabled; - elements[i].disabled = !isEnabled; - } - - if(isEnabled) { - // hide loading when button are enabled - $('#loading').hide(); - } else { - // show loading otherwise - $('#loading').show(); - } - }; - - /** - * Generate the report - * @param key - * @param author - */ - var produceReport = function (key, author) { - // http GET request to the cnes web service - window.SonarRequest.getJSON( - '/api/cnes/report', - { key: key, author: author } - ).then(function (response) { - // on success log generation - log("[INFO] Project report generation response: \n" + response.logs); - log("############################################################\n\tGeneration of the report terminated!\n############################################################\n"); - setEnabled(true); - }).catch(function (error) { - // log error - log("[ERROR] Project report generation failed."); - setEnabled(true); - }); - }; - - /** - * Get projects list from the server and fill out the combo box - */ - var initProjectsDropDownList = function() { - window.SonarRequest.getJSON( - '/api/projects/index' - ).then(function (response) { - // on success - // we put each quality gate in the list - $.each(response, function (i, item) { - // we create a new option for each quality gate - // in the json response - var option = $('