*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 496;
+ public static final int LAST_VERSION = 497;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('494');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('495');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('496');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('497');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-
import java.util.Arrays;
import java.util.Date;
import java.util.List;
}
private void writeIssue(IssueQueryResult result, DefaultIssue issue, JsonWriter json) {
- String message = issue.message();
- String ruleName = result.rule(issue).getName();
Component component = result.component(issue);
Component project = result.project(issue);
String actionPlanKey = issue.actionPlanKey();
.prop("project", issue.projectKey())
.prop("projectLongName", project != null ? project.longName() : null)
.prop("rule", issue.ruleKey().toString())
- .prop("ruleName", ruleName)
+ .prop("ruleName", result.rule(issue).getName())
.prop("line", issue.line())
- .prop("message", message != null ? message : ruleName)
+ .prop("message",issue.message())
.prop("resolution", issue.resolution())
.prop("status", issue.status())
.prop("severity", issue.severity())
hash = {
:maxResultsReached => results.maxResultsReached,
:paging => paging_to_hash(results.paging),
- :issues => results.issues.map { |issue| Issue.to_hash(issue, results.rule(issue) ? results.rule(issue).name : nil) },
+ :issues => results.issues.map { |issue| Issue.to_hash(issue) },
:components => results.components.map { |component| component_to_hash(component) },
:projects => results.projects.map { |project| component_to_hash(project) },
:rules => results.rules.map { |rule| Rule.to_hash(rule) },
}
hash[:resolution] = issue.resolution if issue.resolution
hash[:severity] = issue.severity if issue.severity
- hash[:message] = issue.message ? issue.message : rule_name
+ hash[:message] = issue.message if issue.message
hash[:line] = issue.line.to_i if issue.line
hash[:effortToFix] = issue.effortToFix.to_f if issue.effortToFix
hash[:technicalDebt] = technical_debt_to_hash(issue.technicalDebt) if issue.technicalDebt
<td><i class="icon-severity-<%= issue.severity.downcase -%>"></i></td>
<td>
<a class="rule-modal" href="#" onclick="return openModalWindow('<%= url_for :controller => 'issue', :action => 'show', :id => issue.key, :modal => true -%>', {'width': 800})">
- <!-- SONAR-4785 Display rule name if issue has no message -->
- <%= h truncate(issue.message ? issue.message : results.rule(issue).name, :length => 100) -%></a>
+ <%= h truncate(issue.message, :length => 100) -%></a>
<% if last_comment %>
<div class="comment-excerpt">
<img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/>
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2013 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.
+#
+
+#
+# Sonar 4.2
+# SONAR-4785
+#
+class UpdateIssueMessageByRuleNameWhenNoMessage < ActiveRecord::Migration
+
+ class Rule < ActiveRecord::Base
+ end
+
+ class Issue < ActiveRecord::Base
+ belongs_to :rule, :class_name => 'Rule', :foreign_key => 'rule_id'
+ end
+
+ def self.up
+ issuesWithoutMessage = Issue.all(
+ :include => :rule,
+ :conditions => 'message IS NULL'
+ )
+ issuesWithoutMessage.each do |issue|
+ issue.message = issue.rule.name
+ issue.save!
+ end
+ end
+end
request.execute().assertJson(getClass(), "show_issue_with_changelog.json");
}
- /**
- * SONAR-4785
- */
- @Test
- public void show_issue_display_name_when_no_message() throws Exception {
- Issue issue = createStandardIssue().setMessage(null);
- issues.add(issue);
-
- MockUserSession.set();
- WsTester.TestRequest request = tester.newRequest("show").setParam("key", issue.key());
- request.execute().assertJson(getClass(), "show_issue_display_name_when_no_message.json");
- }
-
private DefaultIssue createStandardIssue() {
DefaultIssue issue = createIssue();
addComponentAndProject();
private DefaultIssue createIssue() {
return new DefaultIssue()
.setKey("ABCD")
- .setMessage("Fix it")
.setComponentKey("org.sonar.server.issue.IssueClient")
.setProjectKey("org.sonar.Sonar")
.setRuleKey(RuleKey.of("squid", "AvoidCycle"))
+++ /dev/null
-{
- "issue": {
- "key": "ABCD",
- "component": "org.sonar.server.issue.IssueClient",
- "componentLongName": "SonarQube :: Issue Client",
- "componentQualifier": "FIL",
- "project": "org.sonar.Sonar",
- "projectLongName": "SonarQube",
- "rule": "squid:AvoidCycle",
- "ruleName": "Avoid cycle",
- "message": "Avoid cycle",
- "creationDate": "2014-01-22T19:10:03+0100",
- "fCreationDate": "Jan 22, 2014 10:03 AM",
- "transitions": [],
- "actions": [],
- "comments": [],
- "changelog": [
- {
- "creationDate": "2014-01-22T19:10:03+0100",
- "fCreationDate": "Jan 22, 2014 10:03 AM",
- "diffs": ["Created"]
- }
- ]
- }
-}
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"transitions": [],
"project": "org.sonar.Sonar",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"transitions": [],
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"actionPlan" : "AP-ABCD",
"actionPlanName" : "Version 4.2",
"creationDate": "2014-01-22T19:10:03+0100",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"status": "OPEN",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"status": "OPEN",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"status": "OPEN",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"transitions": [],
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"characteristic": "Maintainability",
"subCharacteristic": "Readability",
"creationDate": "2014-01-22T19:10:03+0100",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"transitions": [],
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"updateDate": "2014-01-23T19:10:03+0100",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"status": "OPEN",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"debt": "2 hours 1 minutes",
"creationDate": "2014-01-22T19:10:03+0100",
"fCreationDate": "Jan 22, 2014 10:03 AM",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"status": "RESOLVED",
"resolution": "FIXED",
"creationDate": "2014-01-22T19:10:03+0100",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"assignee": "john",
"assigneeName": "John",
"reporter": "steven",
"projectLongName": "SonarQube",
"rule": "squid:AvoidCycle",
"ruleName": "Avoid cycle",
- "message": "Fix it",
"assignee": "john",
"assigneeName": "John",
"status": "OPEN",