The service code uses DateUtils to convert a long into a String format,
which DateUtils converting the long to an instant, then an
OffsetDateTime before passing this through a formatter, using the local
timezone during the OffsetDateTime conversion.
As the test was using a pre-created String based on the UTC timezone,
the test does not correctly compare the values when being executed in a
different timezone. To overcome this, the test has been altered to use
the same DateUtils methods to convert from the long to a String, thereby
ensuring the same timezone handling is using in both test and live code.
The sonarqube images no longer create a sonarqube group for the
sonarqube user to be placed into, instead they put the sonarqube user in
the root group. To prevent the plugin builds failing when attempting to
set the plugin ownership to a group that doesn't exist, the `chown`
command is being altered to only set the user ownership, not the
associated group.
The Bitbucket decoration is currently using the project key to create
the analysis report key, but the Sonarqube documentation states this
should be a static value across all projects. To ensure that the
Bitbucket `Required report` configuration can be created as per the
guidance in Sonarqube documentation, the static key is being used where
the repository has not been set as a monorepo.
The resolution of Pull Request details currently uses the project
default branch when a pull request is analysed without specifying a
target branch. However, when a target branch is specified, the plugin
expects that branch to exist and throws an exception if the target
branch is not found. To overcome this, the target branch is being
resolved to the default branch where no target branch is specified or
the requested target branch does not exist. As the API used to gather
branch information does not return PULL_REQUEST details, the result of
this searching is that a pull request will either target a branch from
the main branch, or target the main branch, there is no further nesting
or pull requests and branches.
The Github Cloud API now returns an error about the input message being
malformed, seemingly due to a change in how new lines in messages are
being handled. As the use of blockquotes around multi-line messages
appears to continue to work, the analysis messages are being wrapped in
blockquotes rather than double-quotes where they contain newline
characters. This requires an interim measure of cloning the InputObject
class from the nodes library to alter the String comparison and wrapping
since the library is no longer maintained.
Sonarqube currently reports a fixed issues metric for pull requests, but
the plugin isn't providing the data to allow that value to be
calculated. To resolve this an additional IssueVisitor has been
introduced that compares the issues from the target branch with the
findings on the source branch and finds any target code blocks that no
longer exists - implying the issue line has been removed - or any code
that still exists but is now reporting the issue as fixed, and reports
them to the PullRequestFixedIssuesRepository which is used within
Sonarqube to gather the count of issues fixed in the current analysis.
The component ID was being used to create a map of analysis dates to
items, but the Pull Request's component ID did not map into this item,
so the Pull Request web service was always returning the analysis date
as empty. The service has been altered to use the root component ID as
was used in the search to ensure the IDs align.
Where Sonarqube does not have duplication information recorded on a
branch, such as there being no code to analyse, the duplication
information may be null. THe plugin is being altered to show this as a
`0` rather than throwing an exception when trying to format the missing
value.
MarkdownFormatterFactory uses System.lineSeparator() as the end-of-line
character for annotation comments.
GraphqlGithubClient.postSummaryComment(), however, uses hardcoded \r\n
as end-of-line character, so it isn't able to match legitimate comments
if SonarQube is not running on Windows.
This change updates GraphqlGithubClient to also use system end-of-line
char.
Updates to the latest Sonarqube minor version, including changes
to the Github decorator to handle changes in the JTW library method
signatures inherited from Sonarqube core, and test only changes to
the Class Loader code built into Sonarqube.
The Github decorator was not checking the project key listed against a summary
comment so was minimising all summary comments when performing multiple
decorations against a mono-repository. To overcome this, the contents of the
summary comments are being retrieved and only the ones with a project key
matching the current project are being minimised during decoration.
Some email clients block the loading of SVG images,
resulting in the summary reports not displaying
cleanly. PNG equivalents of those images has been
generated and the report generation switched to use
them. The old SVG images have been retained to
ensure that existing reports continue to render
where possible.