aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-03-14 12:54:39 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-03-14 17:28:19 +0600
commitaf03cde80a12ac335c3be04c24f5d099b2e84013 (patch)
treefca00e2446c8aece601d5a5dab383c0b18bcf36f
parent57e19e6ea0b8e23ada345f471a7cb90c82526cbf (diff)
downloadsonarqube-af03cde80a12ac335c3be04c24f5d099b2e84013.tar.gz
sonarqube-af03cde80a12ac335c3be04c24f5d099b2e84013.zip
SONAR-5007 Display rule key and parameters
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb25
-rw-r--r--sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee8
-rw-r--r--sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js16
-rw-r--r--sonar-server/src/main/webapp/stylesheets/coding-rules.css11
-rw-r--r--sonar-server/src/main/webapp/stylesheets/coding-rules.less19
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css2
6 files changed, 74 insertions, 7 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb
index 1362d56a5c7..2e6b320a42c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb
@@ -3,9 +3,11 @@
{{#notEq status 'READY'}}
<span class="coding-rules-detail-status">{{status}}</span>
{{/notEq}}
- {{name}}
+ <span class="coding-rules-detail-key">{{key}}</span> : {{name}}
</h3>
+
<ul class="coding-rules-detail-properties">
+ <li class="coding-rules-detail-property">{{severityIcon severity}} {{t "severity" severity}}</li>
<li class="coding-rules-detail-property"><i class="icon-lang"></i> {{language}}</li>
<li class="coding-rules-detail-property"><i class="icon-calendar"></i> {{fCreationDate}}</li>
<li class="coding-rules-detail-property"><i class="icon-tags"></i> {{join tags ', '}}</li>
@@ -16,7 +18,27 @@
<div class="coding-rules-detail-description coding-rules-detail-description-extra rule-desc">{{{extra}}}</div>
{{/if}}
+ <table class="data zebra coding-rules-detail-parameters">
+ <thead>
+ <tr>
+ <th>{{t 'coding_rules.parameters.key'}}</th>
+ <th>{{t 'coding_rules.parameters.default_value'}}</th>
+ <th>{{t 'coding_rules.parameters.description'}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each parameters}}
+ <tr class="coding-rules-detail-parameter">
+ <td>{{key}}</td>
+ <td>{{#if default}}{{default}}{{else}}—{{/if}}</td>
+ <td>{{description}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+
+ {{!--
<h3 class="coding-rules-detail-header coding-rules-detail-quality-profiles-header">
{{t 'coding_rules.quality_profiles'}}
@@ -53,4 +75,5 @@
</li>
{{/each}}
</ul>
+ --}}
</script>
diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee
index e5193ba90f7..0a03ca2ce21 100644
--- a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee
+++ b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee
@@ -88,6 +88,10 @@ define ['jquery.mockjax'], ->
'coding_rules.filters.status': 'Status'
'coding_rules.filters.tag': 'Tag'
+ 'coding_rules.parameters.key': 'Key'
+ 'coding_rules.parameters.default_value': 'Default Value'
+ 'coding_rules.parameters.description': 'Description'
+
'coding_rules.sort.creation_date': 'Creation Date'
'coding_rules.sort.name': 'Name'
@@ -142,6 +146,10 @@ define ['jquery.mockjax'], ->
status: 'DEPRECATED'
repository: 'squid'
key: 'S1190'
+ parameters: [
+ { key: 'someParameterName', type: 'INT', default: '', description: 'Some parameter description' }
+ { key: 'boolParameter', type: 'BOOL', default: true, description: 'Bool parameter description' }
+ ]
description: '''
<p>
According to the Java Language Specification:
diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js
index 22f77272dcc..f1c82651d74 100644
--- a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js
+++ b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js
@@ -100,6 +100,9 @@
'coding_rules.filters.severity': 'Severity',
'coding_rules.filters.status': 'Status',
'coding_rules.filters.tag': 'Tag',
+ 'coding_rules.parameters.key': 'Key',
+ 'coding_rules.parameters.default_value': 'Default Value',
+ 'coding_rules.parameters.description': 'Description',
'coding_rules.sort.creation_date': 'Creation Date',
'coding_rules.sort.name': 'Name'
}
@@ -149,6 +152,19 @@
status: 'DEPRECATED',
repository: 'squid',
key: 'S1190',
+ parameters: [
+ {
+ key: 'someParameterName',
+ type: 'INT',
+ "default": '',
+ description: 'Some parameter description'
+ }, {
+ key: 'boolParameter',
+ type: 'BOOL',
+ "default": true,
+ description: 'Bool parameter description'
+ }
+ ],
description: '<p>\nAccording to the Java Language Specification:\n</p>\n\n<pre>For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of)\nthe empty bracket pairs that form the declaration of the array type after\nthe formal parameter list. This obsolescent syntax should not be used in new code.\n</pre>\n\n<p>The following code snippet illustrates this rule:</p>\n\n<pre>public int getVector()[] { /* ... */ } // Non-Compliant\n\npublic int[] getVector() { /* ... */ } // Compliant\n\npublic int[] getMatrix()[] { /* ... */ } // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ } // Compliant\n</pre>',
extra: '<p>This note is here <b>only for test purposes</b>.</p>',
qualityProfiles: [
diff --git a/sonar-server/src/main/webapp/stylesheets/coding-rules.css b/sonar-server/src/main/webapp/stylesheets/coding-rules.css
index 7fb5ad5eae9..d6a637f0d0d 100644
--- a/sonar-server/src/main/webapp/stylesheets/coding-rules.css
+++ b/sonar-server/src/main/webapp/stylesheets/coding-rules.css
@@ -17,7 +17,8 @@
* Detail
*/
.coding-rules-detail-header {
- margin-bottom: 10px;
+ margin-bottom: 20px;
+ line-height: 1.5;
font-weight: bold;
text-transform: uppercase;
}
@@ -29,7 +30,7 @@
text-transform: uppercase;
}
.coding-rules-detail-properties {
- margin: 10px 0;
+ margin: 20px 0;
font-size: 0;
}
.coding-rules-detail-property {
@@ -57,6 +58,12 @@
margin-top: -10px;
border-left-color: #cdcdcd;
}
+.coding-rules-detail-parameters {
+ margin: 20px 0;
+}
+.coding-rules-detail-parameter {
+ margin: 10px 0;
+}
.coding-rules-detail-quality-profiles-header {
margin-top: 30px;
}
diff --git a/sonar-server/src/main/webapp/stylesheets/coding-rules.less b/sonar-server/src/main/webapp/stylesheets/coding-rules.less
index 5097295ae19..2bfcfa5e460 100644
--- a/sonar-server/src/main/webapp/stylesheets/coding-rules.less
+++ b/sonar-server/src/main/webapp/stylesheets/coding-rules.less
@@ -18,7 +18,8 @@
*/
.coding-rules-detail-header {
- margin-bottom: @navigatorPadding;
+ margin-bottom: 2 * @navigatorPadding;
+ line-height: 1.5;
font-weight: bold;
text-transform: uppercase;
}
@@ -31,8 +32,12 @@
text-transform: uppercase;
}
+.coding-rules-detail-key {
+
+}
+
.coding-rules-detail-properties {
- margin: @navigatorPadding 0;
+ margin: 2 * @navigatorPadding 0;
font-size: 0;
}
@@ -63,10 +68,18 @@
}
.coding-rules-detail-description-extra {
- margin-top: -10px;
+ margin-top: -@navigatorPadding;
border-left-color: @darkGrey;
}
+.coding-rules-detail-parameters {
+ margin: 2 * @navigatorPadding 0;
+}
+
+.coding-rules-detail-parameter {
+ margin: @navigatorPadding 0;
+}
+
// Quality Profiles
.coding-rules-detail-quality-profiles-header {
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index c838716737f..042653c1b31 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -406,7 +406,7 @@ table.data th img, table.data td img {
vertical-align: sub;
}
-table.data.zebra tr:nth-child(odd) {
+table.data.zebra tbody tr:nth-child(odd) {
background-color: #EFEFEF;
}