Skip to content
This repository was archived by the owner on Apr 2, 2019. It is now read-only.

Commit 87582bb

Browse files
author
Janos Gyerik
committed
Use single-quote for image titles, easier to read
1 parent 56b35db commit 87582bb

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

src/main/java/org/sonar/plugins/github/MarkDownReportBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public ReportBuilder append(Severity severity) {
6464
}
6565

6666
private static String formatImageLinkDefinition(Severity severity) {
67-
return String.format("[%s]: %s \"Severity: %s\"", severity.name(), MarkDownUtils.getImageUrl(severity), severity.name());
67+
return String.format("[%s]: %s 'Severity: %s'", severity.name(), MarkDownUtils.getImageUrl(severity), severity.name());
6868
}
6969

7070
private static String formatImageLinkReference(Severity severity) {

src/test/java/org/sonar/plugins/github/GlobalReportTest.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void oneIssue() {
8888
String desiredMarkdown = "SonarQube analysis reported 1 issue\n" +
8989
"* ![INFO][INFO] 1 info\n" +
9090
"\nWatch the comments in this conversation to review them.\n" +
91-
"\n[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"";
91+
"\n[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'";
9292

9393
String formattedGlobalReport = globalReport.formatForMarkdown();
9494

@@ -104,7 +104,7 @@ public void oneIssueOnDir() {
104104
"Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:\n\n"
105105
+
106106
"1. ![INFO][INFO] component0: Issue0 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule0)\n" +
107-
"\n[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"";
107+
"\n[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'";
108108

109109
String formattedGlobalReport = globalReport.formatForMarkdown();
110110

@@ -128,11 +128,11 @@ public void shouldFormatIssuesForMarkdownNoInline() {
128128
"* ![INFO][INFO] 1 info\n" +
129129
"\nWatch the comments in this conversation to review them.\n"
130130
+ "\n"
131-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
132-
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png \"Severity: CRITICAL\"\n"
133-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"\n"
134-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"\n"
135-
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png \"Severity: MINOR\"";
131+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
132+
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png 'Severity: CRITICAL'\n"
133+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'\n"
134+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'\n"
135+
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png 'Severity: MINOR'";
136136

137137
String formattedGlobalReport = globalReport.formatForMarkdown();
138138

@@ -162,11 +162,11 @@ public void shouldFormatIssuesForMarkdownMixInlineGlobal() {
162162
+
163163
"1. ![CRITICAL][CRITICAL] [sonar-github](https://github.com/SonarCommunity/sonar-github): Issue 3 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule3)\n"
164164
+ "\n"
165-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
166-
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png \"Severity: CRITICAL\"\n"
167-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"\n"
168-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"\n"
169-
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png \"Severity: MINOR\"";
165+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
166+
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png 'Severity: CRITICAL'\n"
167+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'\n"
168+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'\n"
169+
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png 'Severity: MINOR'";
170170

171171
String formattedGlobalReport = globalReport.formatForMarkdown();
172172

@@ -193,11 +193,11 @@ public void shouldFormatIssuesForMarkdownWhenInlineCommentsDisabled() {
193193
+
194194
"1. ![BLOCKER][BLOCKER] [sonar-github](https://github.com/SonarCommunity/sonar-github): Issue 4 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule4)\n"
195195
+ "\n"
196-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
197-
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png \"Severity: CRITICAL\"\n"
198-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"\n"
199-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"\n"
200-
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png \"Severity: MINOR\"";
196+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
197+
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png 'Severity: CRITICAL'\n"
198+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'\n"
199+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'\n"
200+
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png 'Severity: MINOR'";
201201

202202
String formattedGlobalReport = globalReport.formatForMarkdown();
203203

@@ -228,11 +228,11 @@ public void shouldFormatIssuesForMarkdownWhenInlineCommentsDisabledAndLimitReach
228228
+
229229
"1. ![CRITICAL][CRITICAL] [sonar-github](https://github.com/SonarCommunity/sonar-github): Issue 3 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule3)\n"
230230
+ "\n"
231-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
232-
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png \"Severity: CRITICAL\"\n"
233-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"\n"
234-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"\n"
235-
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png \"Severity: MINOR\"";
231+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
232+
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png 'Severity: CRITICAL'\n"
233+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'\n"
234+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'\n"
235+
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png 'Severity: MINOR'";
236236

237237
String formattedGlobalReport = globalReport.formatForMarkdown();
238238

@@ -271,7 +271,7 @@ public void shouldLimitGlobalIssues() {
271271
+
272272
"1. ![MAJOR][MAJOR] [File.java#L9](https://github.com/SonarCommunity/sonar-github/File.java#L9): Issue number:9 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule9)\n"
273273
+ "\n"
274-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"";
274+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'";
275275

276276
String formattedGlobalReport = globalReport.formatForMarkdown();
277277

@@ -308,7 +308,7 @@ public void shouldLimitGlobalIssuesWhenInlineCommentsDisabled() {
308308
+
309309
"1. ![MAJOR][MAJOR] [File.java#L9](https://github.com/SonarCommunity/sonar-github/File.java#L9): Issue number:9 [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://myserver/coding_rules#rule_key=repo%3Arule9)\n"
310310
+ "\n"
311-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"";
311+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'";
312312

313313
String formattedGlobalReport = globalReport.formatForMarkdown();
314314

src/test/java/org/sonar/plugins/github/MarkDownReportBuilderTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void should_append_severity_using_reference_links() {
5151
assertThat(builder.toString()).isEqualTo("![BLOCKER][BLOCKER] fix the leak!\n"
5252
+ "Check comments too!\n"
5353
+ "\n"
54-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"");
54+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'");
5555
}
5656

5757
@Test
@@ -64,7 +64,7 @@ public void should_append_reference_definition_only_once() {
6464
+ "![BLOCKER][BLOCKER] fix the leak!\n"
6565
+ "Check comments too!\n"
6666
+ "\n"
67-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"");
67+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'");
6868
}
6969

7070
@Test
@@ -79,11 +79,11 @@ public void should_append_reference_definition_for_all_known_severity() {
7979
+ "![CRITICAL][CRITICAL] a CRITICAL-level issue\n"
8080
+ "![BLOCKER][BLOCKER] a BLOCKER-level issue\n"
8181
+ "\n"
82-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
83-
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png \"Severity: CRITICAL\"\n"
84-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"\n"
85-
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png \"Severity: MAJOR\"\n"
86-
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png \"Severity: MINOR\"");
82+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
83+
+ "[CRITICAL]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-critical.png 'Severity: CRITICAL'\n"
84+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'\n"
85+
+ "[MAJOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR'\n"
86+
+ "[MINOR]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png 'Severity: MINOR'");
8787
}
8888

8989
@Test
@@ -104,8 +104,8 @@ public void should_append_reference_definitions_for_extra_issues_too() {
104104
+ "\n"
105105
+ "Check comments too!\n"
106106
+ "\n"
107-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"\n"
108-
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png \"Severity: INFO\"");
107+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'\n"
108+
+ "[INFO]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-info.png 'Severity: INFO'");
109109
}
110110

111111
@Test
@@ -122,6 +122,6 @@ public void should_append_reference_definitions_for_extra_issues_only_if_used()
122122
assertThat(builder.toString()).isEqualTo("![BLOCKER][BLOCKER] fix the leak!\n"
123123
+ "Check comments too!\n"
124124
+ "\n"
125-
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png \"Severity: BLOCKER\"");
125+
+ "[BLOCKER]: https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-blocker.png 'Severity: BLOCKER'");
126126
}
127127
}

0 commit comments

Comments
 (0)