aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-17 15:32:13 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-03-17 15:32:22 +0100
commit083b9e143663fefdcf9ad0f71457bbbe70d60174 (patch)
tree11a92a1d0f7501ec011c13e73b78abe10aefb923 /server
parent12f6213141fbd03c9de2d2d377394299f39873bb (diff)
downloadsonarqube-083b9e143663fefdcf9ad0f71457bbbe70d60174.tar.gz
sonarqube-083b9e143663fefdcf9ad0f71457bbbe70d60174.zip
add some web tests
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/Gruntfile.coffee1
-rw-r--r--server/sonar-web/src/main/js/coding-rules/filters-view.js10
-rw-r--r--server/sonar-web/src/test/js/coding-rules-page-bulk-change.js273
-rw-r--r--server/sonar-web/src/test/js/coding-rules-page-header.js162
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-bulk-change/app.json316
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-bulk-change/search-qprofile-active.json371
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-bulk-change/search.json371
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-header/app.json316
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-header/search.json371
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-header/search2.json371
-rw-r--r--server/sonar-web/src/test/json/coding-rules-page-header/show.json76
11 files changed, 2629 insertions, 9 deletions
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee
index 923cd20b34b..906e0a034d3 100644
--- a/server/sonar-web/Gruntfile.coffee
+++ b/server/sonar-web/Gruntfile.coffee
@@ -366,6 +366,7 @@ module.exports = (grunt) ->
test: true
'fail-fast': true
verbose: true
+ parallel: !isWindows
port: expressPort
src: ['src/test/js/**/*<%= grunt.option("spec") %>*.js']
single:
diff --git a/server/sonar-web/src/main/js/coding-rules/filters-view.js b/server/sonar-web/src/main/js/coding-rules/filters-view.js
index e4acf24227d..5b888444bc9 100644
--- a/server/sonar-web/src/main/js/coding-rules/filters-view.js
+++ b/server/sonar-web/src/main/js/coding-rules/filters-view.js
@@ -22,15 +22,7 @@ define([
], function () {
return Marionette.ItemView.extend({
- template: Templates['coding-rules-filters'],
-
- events: {
- 'click .js-new-search': 'newSearch'
- },
-
- newSearch: function () {
- this.options.app.controller.newSearch();
- }
+ template: Templates['coding-rules-filters']
});
});
diff --git a/server/sonar-web/src/test/js/coding-rules-page-bulk-change.js b/server/sonar-web/src/test/js/coding-rules-page-bulk-change.js
new file mode 100644
index 00000000000..9d455734b08
--- /dev/null
+++ b/server/sonar-web/src/test/js/coding-rules-page-bulk-change.js
@@ -0,0 +1,273 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+/* global casper:false */
+
+var lib = require('../lib'),
+ testName = lib.testName('Coding Rules', 'Bulk Change');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules-page-bulk-change');
+lib.configureCasper();
+
+
+casper.test.begin(testName('Activate', 'Success'), function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ lib.mockRequest('/api/qualityprofiles/activate_rules', '{ "succeeded": 225 }');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ test.assertExists('.js-bulk-change');
+ casper.click('.js-bulk-change');
+ casper.waitForSelector('.bubble-popup');
+ })
+
+ .then(function () {
+ test.assertExists('.bubble-popup .js-bulk-change[data-action="activate"]');
+ casper.click('.js-bulk-change[data-action="activate"]');
+ casper.waitForSelector('.modal');
+ })
+
+ .then(function () {
+ test.assertExists('.modal #coding-rules-bulk-change-profile');
+ test.assertExists('.modal #coding-rules-submit-bulk-change');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ jQuery('#coding-rules-bulk-change-profile').val('java-default-with-mojo-conventions-49307');
+ });
+ })
+
+ .then(function () {
+ casper.click('.modal #coding-rules-submit-bulk-change');
+ casper.waitForSelector('.modal .alert-success');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('.modal', '225');
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Activate', 'Failed'), function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ lib.mockRequest('/api/qualityprofiles/activate_rules', '{ "succeeded": 225, "failed": 395 }');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ test.assertExists('.js-bulk-change');
+ casper.click('.js-bulk-change');
+ casper.waitForSelector('.bubble-popup');
+ })
+
+ .then(function () {
+ test.assertExists('.bubble-popup .js-bulk-change[data-action="activate"]');
+ casper.click('.js-bulk-change[data-action="activate"]');
+ casper.waitForSelector('.modal');
+ })
+
+ .then(function () {
+ test.assertExists('.modal #coding-rules-bulk-change-profile');
+ test.assertExists('.modal #coding-rules-submit-bulk-change');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ jQuery('#coding-rules-bulk-change-profile').val('java-default-with-mojo-conventions-49307');
+ });
+ })
+
+ .then(function () {
+ casper.click('.modal #coding-rules-submit-bulk-change');
+ casper.waitForSelector('.modal .alert-warning');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('.modal', '225');
+ test.assertSelectorContains('.modal', '395');
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Filter Profiles by Language'), 4, function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ casper.click('.js-facet[data-value="java"]');
+ test.assertExists('.js-bulk-change');
+ casper.click('.js-bulk-change');
+ casper.waitForSelector('.bubble-popup');
+ })
+
+ .then(function () {
+ test.assertExists('.bubble-popup .js-bulk-change[data-action="activate"]');
+ casper.click('.js-bulk-change[data-action="activate"]');
+ casper.waitForSelector('.modal');
+ })
+
+ .then(function () {
+ test.assertExists('.modal #coding-rules-bulk-change-profile');
+ test.assertEqual(8, casper.evaluate(function () {
+ return jQuery('.modal').find('#coding-rules-bulk-change-profile').find('option').length;
+ }));
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Change Selected Profile'), 4, function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search-qprofile-active.json',
+ { data: { activation: true } });
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ lib.mockRequest('/api/qualityprofiles/deactivate_rules', '{ "succeeded": 7 }');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ casper.click('[data-property="qprofile"] .js-facet-toggle');
+ casper.waitForSelector('.js-facet[data-value="java-default-with-mojo-conventions-49307"]');
+ })
+
+ .then(function () {
+ casper.click('.js-facet[data-value="java-default-with-mojo-conventions-49307"]');
+ casper.waitForSelectorTextChange('#coding-rules-total');
+ })
+
+ .then(function () {
+ test.assertExists('.js-bulk-change');
+ casper.click('.js-bulk-change');
+ casper.waitForSelector('.bubble-popup');
+ })
+
+ .then(function () {
+ test.assertExists('.bubble-popup .js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]');
+ casper.click('.js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]');
+ casper.waitForSelector('.modal');
+ })
+
+ .then(function () {
+ test.assertDoesntExist('.modal #coding-rules-bulk-change-profile');
+ casper.click('.modal #coding-rules-submit-bulk-change');
+ casper.waitForSelector('.modal .alert-success');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('.modal', '7');
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
diff --git a/server/sonar-web/src/test/js/coding-rules-page-header.js b/server/sonar-web/src/test/js/coding-rules-page-header.js
new file mode 100644
index 00000000000..0cd140a460e
--- /dev/null
+++ b/server/sonar-web/src/test/js/coding-rules-page-header.js
@@ -0,0 +1,162 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+/* global casper:false */
+
+var lib = require('../lib'),
+ testName = lib.testName('Coding Rules', 'Header');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules-page-header');
+lib.configureCasper();
+
+
+casper.test.begin(testName('Reload'), 2, function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ this.searchMock = lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('#coding-rules-total', 609);
+ lib.clearRequestMock(this.searchMock);
+ lib.mockRequestFromFile('/api/rules/search', 'search2.json');
+ casper.click('.js-reload');
+ casper.waitForSelectorTextChange('#coding-rules-total');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('#coding-rules-total', 413);
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('New Search'), 3, function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search2.json', { data: { languages: 'java' } });
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('#coding-rules-total', 609);
+ casper.click('.js-facet[data-value="java"]');
+ casper.waitForSelectorTextChange('#coding-rules-total');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('#coding-rules-total', 413);
+ casper.click('.js-new-search');
+ casper.waitForSelectorTextChange('#coding-rules-total');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('#coding-rules-total', 609);
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Go Back'), 2, function (test) {
+ casper
+ .start(lib.buildUrl('coding-rules'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search.json');
+ lib.mockRequestFromFile('/api/rules/show', 'show.json');
+ })
+
+ .then(function () {
+ casper.evaluate(function () {
+ require(['/js/coding-rules/app.js']);
+ jQuery.ajaxSetup({ dataType: 'json' });
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rule.selected', function () {
+ casper.click('.coding-rule.selected .js-rule');
+ });
+ })
+
+ .then(function () {
+ casper.waitForSelector('.coding-rules-detail-header');
+ })
+
+ .then(function () {
+ casper.click('.js-back');
+ test.assertDoesntExist('.js-back');
+ test.assertDoesntExist('.coding-rules-detail-header');
+ })
+
+ .then(function () {
+ lib.sendCoverage();
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
diff --git a/server/sonar-web/src/test/json/coding-rules-page-bulk-change/app.json b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/app.json
new file mode 100644
index 00000000000..50148bb1b6e
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/app.json
@@ -0,0 +1,316 @@
+{
+ "canWrite": true,
+ "qualityprofiles": [
+ {
+ "key": "java-default-with-mojo-conventions-49307",
+ "name": "Default - Maven Conventions",
+ "lang": "java",
+ "parentKey": "java-top-profile-without-formatting-conventions-50037"
+ },
+ {
+ "key": "java-default-with-sonarsource-conventions-27339",
+ "name": "Default - SonarSource conventions",
+ "lang": "java",
+ "parentKey": "java-top-profile-without-formatting-conventions-50037"
+ },
+ {
+ "key": "java-top-profile-without-formatting-conventions-50037",
+ "name": "Default - Top",
+ "lang": "java"
+ },
+ {
+ "key": "java-findbugs-14954",
+ "name": "FindBugs",
+ "lang": "java"
+ },
+ {
+ "key": "java-for-sq-java-plugin-only-92289",
+ "name": "For SQ Java Plugin Only",
+ "lang": "java",
+ "parentKey": "java-default-with-sonarsource-conventions-27339"
+ },
+ {
+ "key": "java-for-sq-only-95381",
+ "name": "For SQ Only",
+ "lang": "java",
+ "parentKey": "java-default-with-sonarsource-conventions-27339"
+ },
+ {
+ "key": "php-psr-2-06315",
+ "name": "PSR-2",
+ "lang": "php"
+ },
+ {
+ "key": "java-sonar-way-80423",
+ "name": "Sonar way",
+ "lang": "java"
+ },
+ {
+ "key": "js-sonar-way",
+ "name": "Sonar way",
+ "lang": "js"
+ },
+ {
+ "key": "php-sonar-way-05548",
+ "name": "Sonar way",
+ "lang": "php"
+ },
+ {
+ "key": "py-sonar-way-80265",
+ "name": "Sonar way",
+ "lang": "py"
+ },
+ {
+ "key": "java-without-findbugs",
+ "name": "Without Findbugs",
+ "lang": "java"
+ }
+ ],
+ "languages": {
+ "py": "Python",
+ "js": "JavaScript",
+ "php": "PHP",
+ "java": "Java"
+ },
+ "repositories": [
+ {
+ "key": "common-java",
+ "name": "Common SonarQube",
+ "language": "java"
+ },
+ {
+ "key": "common-js",
+ "name": "Common SonarQube",
+ "language": "js"
+ },
+ {
+ "key": "common-php",
+ "name": "Common SonarQube",
+ "language": "php"
+ },
+ {
+ "key": "common-py",
+ "name": "Common SonarQube",
+ "language": "py"
+ },
+ {
+ "key": "Pylint",
+ "name": "Pylint",
+ "language": "py"
+ },
+ {
+ "key": "javascript",
+ "name": "SonarQube",
+ "language": "js"
+ },
+ {
+ "key": "php",
+ "name": "SonarQube",
+ "language": "php"
+ },
+ {
+ "key": "python",
+ "name": "SonarQube",
+ "language": "py"
+ },
+ {
+ "key": "squid",
+ "name": "SonarQube",
+ "language": "java"
+ }
+ ],
+ "statuses": {
+ "BETA": "Beta",
+ "DEPRECATED": "Deprecated",
+ "READY": "Ready"
+ },
+ "characteristics": [
+ {
+ "key": "UNDERSTANDABILITY",
+ "name": "Understandability",
+ "parent": "MAINTAINABILITY"
+ },
+ {
+ "key": "MAINTAINABILITY",
+ "name": "Maintainability"
+ },
+ {
+ "key": "TIME_ZONE_RELATED_PORTABILITY",
+ "name": "Time zone related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "READABILITY",
+ "name": "Readability",
+ "parent": "MAINTAINABILITY"
+ },
+ {
+ "key": "SECURITY_FEATURES",
+ "name": "Security features",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "ARCHITECTURE_RELIABILITY",
+ "name": "Architecture related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "OS_RELATED_PORTABILITY",
+ "name": "OS related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "EXCEPTION_HANDLING",
+ "name": "Exception handling",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "LOGIC_CHANGEABILITY",
+ "name": "Logic related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "SOFTWARE_RELATED_PORTABILITY",
+ "name": "Software related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "INPUT_VALIDATION_AND_REPRESENTATION",
+ "name": "Input validation and representation",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "LANGUAGE_RELATED_PORTABILITY",
+ "name": "Language related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "ERRORS",
+ "name": "Errors",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "SECURITY",
+ "name": "Security"
+ },
+ {
+ "key": "RELIABILITY",
+ "name": "Reliability"
+ },
+ {
+ "key": "PORTABILITY",
+ "name": "Portability"
+ },
+ {
+ "key": "HARDWARE_RELATED_PORTABILITY",
+ "name": "Hardware related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "SYNCHRONIZATION_RELIABILITY",
+ "name": "Synchronization related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "TRANSPORTABILITY",
+ "name": "Transportability",
+ "parent": "REUSABILITY"
+ },
+ {
+ "key": "COMPILER_RELATED_PORTABILITY",
+ "name": "Compiler related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "RESOURCE_RELIABILITY",
+ "name": "Resource",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "CPU_EFFICIENCY",
+ "name": "Processor use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "EFFICIENCY",
+ "name": "Efficiency"
+ },
+ {
+ "key": "CHANGEABILITY",
+ "name": "Changeability"
+ },
+ {
+ "key": "DATA_CHANGEABILITY",
+ "name": "Data related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "API_ABUSE",
+ "name": "API abuse",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "ARCHITECTURE_CHANGEABILITY",
+ "name": "Architecture related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "UNIT_TESTS",
+ "name": "Unit tests",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "INSTRUCTION_RELIABILITY",
+ "name": "Instruction related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "REUSABILITY",
+ "name": "Reusability"
+ },
+ {
+ "key": "MODULARITY",
+ "name": "Modularity",
+ "parent": "REUSABILITY"
+ },
+ {
+ "key": "UNIT_TESTABILITY",
+ "name": "Unit level testability",
+ "parent": "TESTABILITY"
+ },
+ {
+ "key": "TESTABILITY",
+ "name": "Testability"
+ },
+ {
+ "key": "INTEGRATION_TESTABILITY",
+ "name": "Integration level testability",
+ "parent": "TESTABILITY"
+ },
+ {
+ "key": "NETWORK_USE",
+ "name": "Network use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "MEMORY_EFFICIENCY",
+ "name": "Memory use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "DATA_RELIABILITY",
+ "name": "Data related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "FAULT_TOLERANCE",
+ "name": "Fault tolerance",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "LOGIC_RELIABILITY",
+ "name": "Logic related reliability",
+ "parent": "RELIABILITY"
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search-qprofile-active.json b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search-qprofile-active.json
new file mode 100644
index 00000000000..cbbb2722ae9
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search-qprofile-active.json
@@ -0,0 +1,371 @@
+{
+ "total": 407,
+ "p": 1,
+ "ps": 25,
+ "rules": [
+ {
+ "key": "squid:S2077",
+ "name": "Values passed to SQL commands should be sanitized",
+ "lang": "java",
+ "langName": "Java",
+ "sysTags": [
+ "cwe",
+ "owasp-top10",
+ "security",
+ "sql"
+ ],
+ "tags": [
+ "custom-tag"
+ ]
+ },
+ {
+ "key": "php:S107",
+ "name": "Functions should not have too many parameters",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1192",
+ "name": "String literals should not be duplicated",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1145",
+ "name": "\"if\" statement conditions should not always evaluate to \"true\" or to \"false\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "bug",
+ "cwe",
+ "security"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S108",
+ "name": "Nested blocks of code should not be left empty",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1301",
+ "name": "\"switch\" statements should have at least 3 \"case\" clauses",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S103",
+ "name": "Lines should not be too long",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1144",
+ "name": "Unused private method should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S105",
+ "name": "Tabulation characters should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1481",
+ "name": "Unused local variables should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1142",
+ "name": "Functions should not contain too many return statements",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S104",
+ "name": "Files should not have too many lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1605",
+ "name": "PHP 4 style calls to parent constructors should not be used in PHP5 \"__construct\" functions",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1448",
+ "name": "Classes should not have too many methods",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1603",
+ "name": "PHP 4 constructor declarations should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1779",
+ "name": "Only LF character (Unix-like) should be used to end lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1185",
+ "name": "Overriding methods should do more than simply call the same method in the super class",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1600",
+ "name": "Deprecated predefined variables should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1109",
+ "name": "A close curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2001",
+ "name": "Functions deprecated in PHP 5 should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "obsolete"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2002",
+ "name": "Errors should not be silenced",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2000",
+ "name": "Files should not contain characters before \"<?php\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "user-experience"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1105",
+ "name": "An open curly brace should be located at the end of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1200",
+ "name": "Classes should not be coupled to too many other classes (Single Responsibility Principle)",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1106",
+ "name": "An open curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ }
+ ],
+ "facets": [
+ {
+ "property": "tags",
+ "values": [
+ {
+ "val": "convention",
+ "count": 67
+ },
+ {
+ "val": "brain-overload",
+ "count": 36
+ },
+ {
+ "val": "bug",
+ "count": 36
+ },
+ {
+ "val": "cwe",
+ "count": 17
+ },
+ {
+ "val": "unused",
+ "count": 16
+ },
+ {
+ "val": "security",
+ "count": 14
+ },
+ {
+ "val": "pitfall",
+ "count": 12
+ },
+ {
+ "val": "psr2",
+ "count": 12
+ },
+ {
+ "val": "error-handling",
+ "count": 11
+ },
+ {
+ "val": "pitfail",
+ "count": 10
+ }
+ ]
+ },
+ {
+ "property": "languages",
+ "values": [
+ {
+ "val": "java",
+ "count": 212
+ },
+ {
+ "val": "py",
+ "count": 212
+ },
+ {
+ "val": "php",
+ "count": 103
+ },
+ {
+ "val": "js",
+ "count": 77
+ }
+ ]
+ },
+ {
+ "property": "repositories",
+ "values": [
+ {
+ "val": "squid",
+ "count": 206
+ },
+ {
+ "val": "Pylint",
+ "count": 180
+ },
+ {
+ "val": "php",
+ "count": 97
+ },
+ {
+ "val": "javascript",
+ "count": 73
+ },
+ {
+ "val": "python",
+ "count": 28
+ },
+ {
+ "val": "common-java",
+ "count": 6
+ },
+ {
+ "val": "common-php",
+ "count": 6
+ },
+ {
+ "val": "manual",
+ "count": 5
+ },
+ {
+ "val": "common-js",
+ "count": 4
+ },
+ {
+ "val": "common-py",
+ "count": 4
+ }
+ ]
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search.json b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search.json
new file mode 100644
index 00000000000..c17c58d2b42
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-bulk-change/search.json
@@ -0,0 +1,371 @@
+{
+ "total": 609,
+ "p": 1,
+ "ps": 25,
+ "rules": [
+ {
+ "key": "squid:S2077",
+ "name": "Values passed to SQL commands should be sanitized",
+ "lang": "java",
+ "langName": "Java",
+ "sysTags": [
+ "cwe",
+ "owasp-top10",
+ "security",
+ "sql"
+ ],
+ "tags": [
+ "custom-tag"
+ ]
+ },
+ {
+ "key": "php:S107",
+ "name": "Functions should not have too many parameters",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1192",
+ "name": "String literals should not be duplicated",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1145",
+ "name": "\"if\" statement conditions should not always evaluate to \"true\" or to \"false\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "bug",
+ "cwe",
+ "security"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S108",
+ "name": "Nested blocks of code should not be left empty",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1301",
+ "name": "\"switch\" statements should have at least 3 \"case\" clauses",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S103",
+ "name": "Lines should not be too long",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1144",
+ "name": "Unused private method should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S105",
+ "name": "Tabulation characters should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1481",
+ "name": "Unused local variables should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1142",
+ "name": "Functions should not contain too many return statements",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S104",
+ "name": "Files should not have too many lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1605",
+ "name": "PHP 4 style calls to parent constructors should not be used in PHP5 \"__construct\" functions",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1448",
+ "name": "Classes should not have too many methods",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1603",
+ "name": "PHP 4 constructor declarations should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1779",
+ "name": "Only LF character (Unix-like) should be used to end lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1185",
+ "name": "Overriding methods should do more than simply call the same method in the super class",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1600",
+ "name": "Deprecated predefined variables should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1109",
+ "name": "A close curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2001",
+ "name": "Functions deprecated in PHP 5 should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "obsolete"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2002",
+ "name": "Errors should not be silenced",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2000",
+ "name": "Files should not contain characters before \"<?php\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "user-experience"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1105",
+ "name": "An open curly brace should be located at the end of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1200",
+ "name": "Classes should not be coupled to too many other classes (Single Responsibility Principle)",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1106",
+ "name": "An open curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ }
+ ],
+ "facets": [
+ {
+ "property": "tags",
+ "values": [
+ {
+ "val": "convention",
+ "count": 67
+ },
+ {
+ "val": "brain-overload",
+ "count": 36
+ },
+ {
+ "val": "bug",
+ "count": 36
+ },
+ {
+ "val": "cwe",
+ "count": 17
+ },
+ {
+ "val": "unused",
+ "count": 16
+ },
+ {
+ "val": "security",
+ "count": 14
+ },
+ {
+ "val": "pitfall",
+ "count": 12
+ },
+ {
+ "val": "psr2",
+ "count": 12
+ },
+ {
+ "val": "error-handling",
+ "count": 11
+ },
+ {
+ "val": "pitfail",
+ "count": 10
+ }
+ ]
+ },
+ {
+ "property": "languages",
+ "values": [
+ {
+ "val": "java",
+ "count": 212
+ },
+ {
+ "val": "py",
+ "count": 212
+ },
+ {
+ "val": "php",
+ "count": 103
+ },
+ {
+ "val": "js",
+ "count": 77
+ }
+ ]
+ },
+ {
+ "property": "repositories",
+ "values": [
+ {
+ "val": "squid",
+ "count": 206
+ },
+ {
+ "val": "Pylint",
+ "count": 180
+ },
+ {
+ "val": "php",
+ "count": 97
+ },
+ {
+ "val": "javascript",
+ "count": 73
+ },
+ {
+ "val": "python",
+ "count": 28
+ },
+ {
+ "val": "common-java",
+ "count": 6
+ },
+ {
+ "val": "common-php",
+ "count": 6
+ },
+ {
+ "val": "manual",
+ "count": 5
+ },
+ {
+ "val": "common-js",
+ "count": 4
+ },
+ {
+ "val": "common-py",
+ "count": 4
+ }
+ ]
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-header/app.json b/server/sonar-web/src/test/json/coding-rules-page-header/app.json
new file mode 100644
index 00000000000..50148bb1b6e
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-header/app.json
@@ -0,0 +1,316 @@
+{
+ "canWrite": true,
+ "qualityprofiles": [
+ {
+ "key": "java-default-with-mojo-conventions-49307",
+ "name": "Default - Maven Conventions",
+ "lang": "java",
+ "parentKey": "java-top-profile-without-formatting-conventions-50037"
+ },
+ {
+ "key": "java-default-with-sonarsource-conventions-27339",
+ "name": "Default - SonarSource conventions",
+ "lang": "java",
+ "parentKey": "java-top-profile-without-formatting-conventions-50037"
+ },
+ {
+ "key": "java-top-profile-without-formatting-conventions-50037",
+ "name": "Default - Top",
+ "lang": "java"
+ },
+ {
+ "key": "java-findbugs-14954",
+ "name": "FindBugs",
+ "lang": "java"
+ },
+ {
+ "key": "java-for-sq-java-plugin-only-92289",
+ "name": "For SQ Java Plugin Only",
+ "lang": "java",
+ "parentKey": "java-default-with-sonarsource-conventions-27339"
+ },
+ {
+ "key": "java-for-sq-only-95381",
+ "name": "For SQ Only",
+ "lang": "java",
+ "parentKey": "java-default-with-sonarsource-conventions-27339"
+ },
+ {
+ "key": "php-psr-2-06315",
+ "name": "PSR-2",
+ "lang": "php"
+ },
+ {
+ "key": "java-sonar-way-80423",
+ "name": "Sonar way",
+ "lang": "java"
+ },
+ {
+ "key": "js-sonar-way",
+ "name": "Sonar way",
+ "lang": "js"
+ },
+ {
+ "key": "php-sonar-way-05548",
+ "name": "Sonar way",
+ "lang": "php"
+ },
+ {
+ "key": "py-sonar-way-80265",
+ "name": "Sonar way",
+ "lang": "py"
+ },
+ {
+ "key": "java-without-findbugs",
+ "name": "Without Findbugs",
+ "lang": "java"
+ }
+ ],
+ "languages": {
+ "py": "Python",
+ "js": "JavaScript",
+ "php": "PHP",
+ "java": "Java"
+ },
+ "repositories": [
+ {
+ "key": "common-java",
+ "name": "Common SonarQube",
+ "language": "java"
+ },
+ {
+ "key": "common-js",
+ "name": "Common SonarQube",
+ "language": "js"
+ },
+ {
+ "key": "common-php",
+ "name": "Common SonarQube",
+ "language": "php"
+ },
+ {
+ "key": "common-py",
+ "name": "Common SonarQube",
+ "language": "py"
+ },
+ {
+ "key": "Pylint",
+ "name": "Pylint",
+ "language": "py"
+ },
+ {
+ "key": "javascript",
+ "name": "SonarQube",
+ "language": "js"
+ },
+ {
+ "key": "php",
+ "name": "SonarQube",
+ "language": "php"
+ },
+ {
+ "key": "python",
+ "name": "SonarQube",
+ "language": "py"
+ },
+ {
+ "key": "squid",
+ "name": "SonarQube",
+ "language": "java"
+ }
+ ],
+ "statuses": {
+ "BETA": "Beta",
+ "DEPRECATED": "Deprecated",
+ "READY": "Ready"
+ },
+ "characteristics": [
+ {
+ "key": "UNDERSTANDABILITY",
+ "name": "Understandability",
+ "parent": "MAINTAINABILITY"
+ },
+ {
+ "key": "MAINTAINABILITY",
+ "name": "Maintainability"
+ },
+ {
+ "key": "TIME_ZONE_RELATED_PORTABILITY",
+ "name": "Time zone related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "READABILITY",
+ "name": "Readability",
+ "parent": "MAINTAINABILITY"
+ },
+ {
+ "key": "SECURITY_FEATURES",
+ "name": "Security features",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "ARCHITECTURE_RELIABILITY",
+ "name": "Architecture related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "OS_RELATED_PORTABILITY",
+ "name": "OS related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "EXCEPTION_HANDLING",
+ "name": "Exception handling",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "LOGIC_CHANGEABILITY",
+ "name": "Logic related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "SOFTWARE_RELATED_PORTABILITY",
+ "name": "Software related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "INPUT_VALIDATION_AND_REPRESENTATION",
+ "name": "Input validation and representation",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "LANGUAGE_RELATED_PORTABILITY",
+ "name": "Language related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "ERRORS",
+ "name": "Errors",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "SECURITY",
+ "name": "Security"
+ },
+ {
+ "key": "RELIABILITY",
+ "name": "Reliability"
+ },
+ {
+ "key": "PORTABILITY",
+ "name": "Portability"
+ },
+ {
+ "key": "HARDWARE_RELATED_PORTABILITY",
+ "name": "Hardware related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "SYNCHRONIZATION_RELIABILITY",
+ "name": "Synchronization related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "TRANSPORTABILITY",
+ "name": "Transportability",
+ "parent": "REUSABILITY"
+ },
+ {
+ "key": "COMPILER_RELATED_PORTABILITY",
+ "name": "Compiler related portability",
+ "parent": "PORTABILITY"
+ },
+ {
+ "key": "RESOURCE_RELIABILITY",
+ "name": "Resource",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "CPU_EFFICIENCY",
+ "name": "Processor use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "EFFICIENCY",
+ "name": "Efficiency"
+ },
+ {
+ "key": "CHANGEABILITY",
+ "name": "Changeability"
+ },
+ {
+ "key": "DATA_CHANGEABILITY",
+ "name": "Data related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "API_ABUSE",
+ "name": "API abuse",
+ "parent": "SECURITY"
+ },
+ {
+ "key": "ARCHITECTURE_CHANGEABILITY",
+ "name": "Architecture related changeability",
+ "parent": "CHANGEABILITY"
+ },
+ {
+ "key": "UNIT_TESTS",
+ "name": "Unit tests",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "INSTRUCTION_RELIABILITY",
+ "name": "Instruction related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "REUSABILITY",
+ "name": "Reusability"
+ },
+ {
+ "key": "MODULARITY",
+ "name": "Modularity",
+ "parent": "REUSABILITY"
+ },
+ {
+ "key": "UNIT_TESTABILITY",
+ "name": "Unit level testability",
+ "parent": "TESTABILITY"
+ },
+ {
+ "key": "TESTABILITY",
+ "name": "Testability"
+ },
+ {
+ "key": "INTEGRATION_TESTABILITY",
+ "name": "Integration level testability",
+ "parent": "TESTABILITY"
+ },
+ {
+ "key": "NETWORK_USE",
+ "name": "Network use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "MEMORY_EFFICIENCY",
+ "name": "Memory use",
+ "parent": "EFFICIENCY"
+ },
+ {
+ "key": "DATA_RELIABILITY",
+ "name": "Data related reliability",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "FAULT_TOLERANCE",
+ "name": "Fault tolerance",
+ "parent": "RELIABILITY"
+ },
+ {
+ "key": "LOGIC_RELIABILITY",
+ "name": "Logic related reliability",
+ "parent": "RELIABILITY"
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-header/search.json b/server/sonar-web/src/test/json/coding-rules-page-header/search.json
new file mode 100644
index 00000000000..c17c58d2b42
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-header/search.json
@@ -0,0 +1,371 @@
+{
+ "total": 609,
+ "p": 1,
+ "ps": 25,
+ "rules": [
+ {
+ "key": "squid:S2077",
+ "name": "Values passed to SQL commands should be sanitized",
+ "lang": "java",
+ "langName": "Java",
+ "sysTags": [
+ "cwe",
+ "owasp-top10",
+ "security",
+ "sql"
+ ],
+ "tags": [
+ "custom-tag"
+ ]
+ },
+ {
+ "key": "php:S107",
+ "name": "Functions should not have too many parameters",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1192",
+ "name": "String literals should not be duplicated",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1145",
+ "name": "\"if\" statement conditions should not always evaluate to \"true\" or to \"false\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "bug",
+ "cwe",
+ "security"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S108",
+ "name": "Nested blocks of code should not be left empty",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1301",
+ "name": "\"switch\" statements should have at least 3 \"case\" clauses",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S103",
+ "name": "Lines should not be too long",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1144",
+ "name": "Unused private method should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S105",
+ "name": "Tabulation characters should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1481",
+ "name": "Unused local variables should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1142",
+ "name": "Functions should not contain too many return statements",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S104",
+ "name": "Files should not have too many lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1605",
+ "name": "PHP 4 style calls to parent constructors should not be used in PHP5 \"__construct\" functions",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1448",
+ "name": "Classes should not have too many methods",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1603",
+ "name": "PHP 4 constructor declarations should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1779",
+ "name": "Only LF character (Unix-like) should be used to end lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1185",
+ "name": "Overriding methods should do more than simply call the same method in the super class",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1600",
+ "name": "Deprecated predefined variables should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1109",
+ "name": "A close curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2001",
+ "name": "Functions deprecated in PHP 5 should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "obsolete"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2002",
+ "name": "Errors should not be silenced",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2000",
+ "name": "Files should not contain characters before \"<?php\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "user-experience"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1105",
+ "name": "An open curly brace should be located at the end of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1200",
+ "name": "Classes should not be coupled to too many other classes (Single Responsibility Principle)",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1106",
+ "name": "An open curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ }
+ ],
+ "facets": [
+ {
+ "property": "tags",
+ "values": [
+ {
+ "val": "convention",
+ "count": 67
+ },
+ {
+ "val": "brain-overload",
+ "count": 36
+ },
+ {
+ "val": "bug",
+ "count": 36
+ },
+ {
+ "val": "cwe",
+ "count": 17
+ },
+ {
+ "val": "unused",
+ "count": 16
+ },
+ {
+ "val": "security",
+ "count": 14
+ },
+ {
+ "val": "pitfall",
+ "count": 12
+ },
+ {
+ "val": "psr2",
+ "count": 12
+ },
+ {
+ "val": "error-handling",
+ "count": 11
+ },
+ {
+ "val": "pitfail",
+ "count": 10
+ }
+ ]
+ },
+ {
+ "property": "languages",
+ "values": [
+ {
+ "val": "java",
+ "count": 212
+ },
+ {
+ "val": "py",
+ "count": 212
+ },
+ {
+ "val": "php",
+ "count": 103
+ },
+ {
+ "val": "js",
+ "count": 77
+ }
+ ]
+ },
+ {
+ "property": "repositories",
+ "values": [
+ {
+ "val": "squid",
+ "count": 206
+ },
+ {
+ "val": "Pylint",
+ "count": 180
+ },
+ {
+ "val": "php",
+ "count": 97
+ },
+ {
+ "val": "javascript",
+ "count": 73
+ },
+ {
+ "val": "python",
+ "count": 28
+ },
+ {
+ "val": "common-java",
+ "count": 6
+ },
+ {
+ "val": "common-php",
+ "count": 6
+ },
+ {
+ "val": "manual",
+ "count": 5
+ },
+ {
+ "val": "common-js",
+ "count": 4
+ },
+ {
+ "val": "common-py",
+ "count": 4
+ }
+ ]
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-header/search2.json b/server/sonar-web/src/test/json/coding-rules-page-header/search2.json
new file mode 100644
index 00000000000..04844b07c9d
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-header/search2.json
@@ -0,0 +1,371 @@
+{
+ "total": 413,
+ "p": 1,
+ "ps": 25,
+ "rules": [
+ {
+ "key": "squid:S2077",
+ "name": "Values passed to SQL commands should be sanitized",
+ "lang": "java",
+ "langName": "Java",
+ "sysTags": [
+ "cwe",
+ "owasp-top10",
+ "security",
+ "sql"
+ ],
+ "tags": [
+ "custom-tag"
+ ]
+ },
+ {
+ "key": "php:S107",
+ "name": "Functions should not have too many parameters",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1192",
+ "name": "String literals should not be duplicated",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1145",
+ "name": "\"if\" statement conditions should not always evaluate to \"true\" or to \"false\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "bug",
+ "cwe",
+ "security"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S108",
+ "name": "Nested blocks of code should not be left empty",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1301",
+ "name": "\"switch\" statements should have at least 3 \"case\" clauses",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S103",
+ "name": "Lines should not be too long",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1144",
+ "name": "Unused private method should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S105",
+ "name": "Tabulation characters should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1481",
+ "name": "Unused local variables should be removed",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "unused"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1142",
+ "name": "Functions should not contain too many return statements",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S104",
+ "name": "Files should not have too many lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1605",
+ "name": "PHP 4 style calls to parent constructors should not be used in PHP5 \"__construct\" functions",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1448",
+ "name": "Classes should not have too many methods",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1603",
+ "name": "PHP 4 constructor declarations should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1779",
+ "name": "Only LF character (Unix-like) should be used to end lines",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention",
+ "psr2"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1185",
+ "name": "Overriding methods should do more than simply call the same method in the super class",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [],
+ "tags": []
+ },
+ {
+ "key": "php:S1600",
+ "name": "Deprecated predefined variables should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1109",
+ "name": "A close curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2001",
+ "name": "Functions deprecated in PHP 5 should not be used",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "obsolete"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2002",
+ "name": "Errors should not be silenced",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "pitfail"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S2000",
+ "name": "Files should not contain characters before \"<?php\"",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "user-experience"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1105",
+ "name": "An open curly brace should be located at the end of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1200",
+ "name": "Classes should not be coupled to too many other classes (Single Responsibility Principle)",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "brain-overload"
+ ],
+ "tags": []
+ },
+ {
+ "key": "php:S1106",
+ "name": "An open curly brace should be located at the beginning of a line",
+ "lang": "php",
+ "langName": "PHP",
+ "sysTags": [
+ "convention"
+ ],
+ "tags": []
+ }
+ ],
+ "facets": [
+ {
+ "property": "tags",
+ "values": [
+ {
+ "val": "convention",
+ "count": 67
+ },
+ {
+ "val": "brain-overload",
+ "count": 36
+ },
+ {
+ "val": "bug",
+ "count": 36
+ },
+ {
+ "val": "cwe",
+ "count": 17
+ },
+ {
+ "val": "unused",
+ "count": 16
+ },
+ {
+ "val": "security",
+ "count": 14
+ },
+ {
+ "val": "pitfall",
+ "count": 12
+ },
+ {
+ "val": "psr2",
+ "count": 12
+ },
+ {
+ "val": "error-handling",
+ "count": 11
+ },
+ {
+ "val": "pitfail",
+ "count": 10
+ }
+ ]
+ },
+ {
+ "property": "languages",
+ "values": [
+ {
+ "val": "java",
+ "count": 212
+ },
+ {
+ "val": "py",
+ "count": 212
+ },
+ {
+ "val": "php",
+ "count": 103
+ },
+ {
+ "val": "js",
+ "count": 77
+ }
+ ]
+ },
+ {
+ "property": "repositories",
+ "values": [
+ {
+ "val": "squid",
+ "count": 206
+ },
+ {
+ "val": "Pylint",
+ "count": 180
+ },
+ {
+ "val": "php",
+ "count": 97
+ },
+ {
+ "val": "javascript",
+ "count": 73
+ },
+ {
+ "val": "python",
+ "count": 28
+ },
+ {
+ "val": "common-java",
+ "count": 6
+ },
+ {
+ "val": "common-php",
+ "count": 6
+ },
+ {
+ "val": "manual",
+ "count": 5
+ },
+ {
+ "val": "common-js",
+ "count": 4
+ },
+ {
+ "val": "common-py",
+ "count": 4
+ }
+ ]
+ }
+ ]
+}
diff --git a/server/sonar-web/src/test/json/coding-rules-page-header/show.json b/server/sonar-web/src/test/json/coding-rules-page-header/show.json
new file mode 100644
index 00000000000..274b587bfb2
--- /dev/null
+++ b/server/sonar-web/src/test/json/coding-rules-page-header/show.json
@@ -0,0 +1,76 @@
+{
+ "rule": {
+ "key": "squid:S1181",
+ "repo": "squid",
+ "name": "Throwable and Error classes should not be caught",
+ "createdAt": "2013-08-09T14:40:54+0200",
+ "severity": "BLOCKER",
+ "status": "READY",
+ "internalKey": "S1181",
+ "isTemplate": false,
+ "tags": [],
+ "sysTags": [
+ "error-handling"
+ ],
+ "lang": "java",
+ "langName": "Java",
+ "htmlDesc": "<p>\n<code>Throwable</code> is the superclass of all errors and exceptions in Java.\n<code>Error</code> is the superclass of all errors which are not meant to be caught by applications.\n</p>\n\n<p>\nCatching either <code>Throwable</code> or <code>Error</code> will also catch <code>OutOfMemoryError</code> or <code>InternalError</code> from which an application should not attempt to recover.\n</p>\n\n<p>Only <code>Exception</code> and its subclasses should be caught.</p>\n\n<h2>Noncompliant Code Example</h2>\n\n<pre>\ntry { /* ... */ } catch (Throwable t) { /* ... */ }\ntry { /* ... */ } catch (Error e) { /* ... */ } \n</pre>\n\n<h2>Compliant Solution</h2>\n\n<pre>\ntry { /* ... */ } catch (Exception e) { /* ... */ } \ntry { /* ... */ } catch (RuntimeException e) { /* ... */ } \ntry { /* ... */ } catch (MyException e) { /* ... */ } \n</pre>",
+ "defaultDebtChar": "RELIABILITY",
+ "defaultDebtSubChar": "EXCEPTION_HANDLING",
+ "debtChar": "RELIABILITY",
+ "debtSubChar": "EXCEPTION_HANDLING",
+ "debtCharName": "Reliability",
+ "debtSubCharName": "Exception handling",
+ "defaultDebtRemFnType": "CONSTANT_ISSUE",
+ "defaultDebtRemFnOffset": "20min",
+ "debtOverloaded": true,
+ "debtRemFnType": "LINEAR",
+ "debtRemFnCoeff": "20min",
+ "params": [
+ {
+ "key": "max",
+ "htmlDesc": "Maximum authorized number of parameters",
+ "type": "INTEGER",
+ "defaultValue": "7"
+ }
+ ]
+ },
+ "actives": [
+ {
+ "qProfile": "java-top-profile-without-formatting-conventions-50037",
+ "inherit": "NONE",
+ "severity": "BLOCKER",
+ "params": []
+ },
+ {
+ "qProfile": "java-default-with-sonarsource-conventions-27339",
+ "inherit": "INHERITED",
+ "severity": "BLOCKER",
+ "params": []
+ },
+ {
+ "qProfile": "java-for-sq-java-plugin-only-92289",
+ "inherit": "INHERITED",
+ "severity": "BLOCKER",
+ "params": []
+ },
+ {
+ "qProfile": "java-for-sq-only-95381",
+ "inherit": "INHERITED",
+ "severity": "BLOCKER",
+ "params": []
+ },
+ {
+ "qProfile": "java-default-with-mojo-conventions-49307",
+ "inherit": "INHERITED",
+ "severity": "BLOCKER",
+ "params": []
+ },
+ {
+ "qProfile": "java-sonar-way-80423",
+ "inherit": "NONE",
+ "severity": "BLOCKER",
+ "params": []
+ }
+ ]
+}