Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed rule link and hotspot link for Sonarcloud 8.0.0 #165

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,21 @@
<th>Description</th>
<th>Message</th>
<th class="hidden">Key</th>
<th>Type</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<% for(var i = 0; i < issues.length; i++) { %>
<tr>
<td><a href="<%= sonarBaseURL %>/coding_rules#rule_key=<%= issues[i].rule %>"><%= issues[i].rule %></a></td>
<td><a href="<%= sonarBaseURL %>/organizations/<%= sonarOrganization %>/rules?open=<%= issues[i].rule %>&rule_key=<%= issues[i].rule %>"><%= issues[i].rule %></a></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after some tests, it only works with sonarqube that manage organizations, I tried to find an api endpoint to get the sonarqube edition but I didn't find any, do you have an idea?

<td><%= issues[i].severity %></td>
<td class="component"><%= issues[i].component %></td>
<td><%= issues[i].line %></td>
<td><%= issues[i].description %></td>
<td><%= issues[i].message %></td>
<td class="hidden"><%= issues[i].key %></td>
<td><%= issues[i].type %></td>
<td><%- issues[i].link(issues[i].status) %></td>
</tr>
<% } %>
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const generateReport = async options => {
const hotspotLink =
options.linkIssues
? (data, hotspot) => (c) =>
`<a href="${data.sonarBaseURL}/security_hotspots?${
`<a href="${data.sonarBaseURL}/project/security_hotspots?${
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data.branch ? "branch=" + encodeURIComponent(data.branch) + "&" : ""
}id=${encodeURIComponent(
data.sonarComponent
Expand Down Expand Up @@ -376,6 +376,7 @@ const generateReport = async options => {
description: message,
message: issue.message,
key: issue.key,
type: issue.type
};
})
);
Expand Down Expand Up @@ -439,6 +440,7 @@ const generateReport = async options => {
description: hotspot.rule ? hotspot.rule.name : "/",
message: hotspot.message,
key: hotspot.key,
type: "SECURITY_HOTSPOT"
});
} catch (error) {
logError("getting hotspots details", error);
Expand Down