1. 15 Oct, 2019 2 commits
    • Michael Clarke's avatar
      Fix test failure on Java 9 and above · e1e16ddc
      Michael Clarke authored
      Java 9 modified classloading to use modules, so the default classloader presented by JUnit is not a `URLClassloader` and therefore fails the type check in `ElevatedClassLoaderFactory`. As Sonarqube always creates a classloader for each plugin during the load of that plugin, the exposing of the default App Classloader in the unit test is therefore invalid, so switching to create a custom `URLClassloader` overcomes this. Similarly, Mockito throws an exception when running in Java 9 and above on Windows due to classes eing generated in the wrong module scope. Upgrading to the latest version of Mockito overcomes this.
      e1e16ddc
    • Michael Clarke's avatar
      Enable CI build in Travis · 3eba6723
      Michael Clarke authored
      As the plugin is currently released using Java 8, OpenJDK 8 is being used until the point that only SonarQube 8 is supported. OpenJDK 11 is being used as a second JVM to ensure correct function against the the main-stream build of SonarQube.
      3eba6723
  2. 08 Aug, 2019 1 commit
  3. 01 Aug, 2019 1 commit
    • Michael Clarke's avatar
      Cleanup configuration from Gradle 5 migration · 7ac2dae9
      Michael Clarke authored
      The recent migration to Gradle 5 introduced the use of the Shadow plugin in place of the unmaintained SonarQube plugin. However, the default configuration of the Shadow plugin does not bundle dependencies, so the plugin would fail to load if depending on any libraries not bundled with SonarQube. The shadow task is therefore being configured to always execute as part of the Gradle `assemble` task being executed, and it's classifier set to an empty String so it is built/deployed with the same name as the original JAR file. To prevent a clash with the original JAR, its task has been disabled, but it's classifier has also been named as 'nodeps' to make it clear it doesn't contain any dependencies.
      
      The shadow plugin has also been updated to the latest version, and the deprecated `layout` syntax used for retrieving SonarQube artifacts replaced with the alternative `patternLayout` syntax, as well as correcting the line endings in `gradlew.bat`.
      7ac2dae9
  4. 31 Jul, 2019 1 commit
  5. 01 Jul, 2019 5 commits
  6. 30 Jun, 2019 1 commit
  7. 27 Jun, 2019 1 commit
  8. 25 Jun, 2019 3 commits
    • Michael Clarke's avatar
    • Michael Clarke's avatar
      77a2423b
    • Michael Clarke's avatar
      #19: Add support for SonarQube 7.8 APIs · 83668265
      Michael Clarke authored
      SonarQube 7.8 contains changes to the APIs required for managing branches, with new methods having been introduced, and the existing `getMergeBranchUUid` method signature in `org.sonar.ce.tasj.projectanalysis.Branch` modified in a non-backwards-compatible way. Due to the incompatible changes, the supported SonarQube API version has been bumped from 7.4 to 7.8 and any methods that only existed to support older SonarQube versions have been removed. The 7.8 release of SonarQube does not currently have a sonar-plugin-api dependency released with it, so the SonarQube 7.7 dependency for the plugin-api component is being used in its place.
      83668265
  9. 22 Jun, 2019 1 commit
  10. 12 Jun, 2019 1 commit
  11. 08 Apr, 2019 4 commits
    • Michael Clarke's avatar
    • Michael Clarke's avatar
      ac5b9876
    • Michael Clarke's avatar
      #6: Fix error when loading project's existing Pull Requests · 2feecd2d
      Michael Clarke authored
      When running a scan, the scanner engine loads existing Pull Request details, but fails to deserialise the response due to a mismatch between the returned data structure and the target model.
      
      Changing the deserialisation method to parse the impacted date field to a Date object using a Date Formatter, and then convert the parsed date to the target model's `long` type resolves this issue.
      2feecd2d
    • Michael Clarke's avatar
      #4: Use correct target branch when generating a pull request details · c06c929b
      Michael Clarke authored
      A lookup is performed on the target branch of a pull request to ensure the branch exists, since SonarQube uses this as the base for collecting metrics on the Pull Request. However, the retrieved branch is then used incorrectly, with the UUID of the retrieved branch's target branch being returned as the target for the Pull Request, rather than the UUID of the retrieved branch. As long-lived branches that are generally targeted by Pull Requests will not have a target branch, this may result in a `NoSuchElementException` from SonarQube's Compute Engine when trying to use the non-existent UUID, or SonarQube showing the wrong branch as being targeted for a pull request and picking up new issues on the source branch incorrectly where a short-lived branch is targeted.
      
      This change updates the generation of the pull request details to use the UUID of the retrieved target branch when creating Pull Request details, rather than the UUID of the target of the retrieved target branch.
      c06c929b
  12. 27 Mar, 2019 3 commits
    • Michael Clarke's avatar
    • Michael Clarke's avatar
      14acbf73
    • Michael Clarke's avatar
      #1: Only error when no branches exist and non-master branch specified · d02f2488
      Michael Clarke authored
      SonarQube returns an empty branch list if the project doesn't already exist, which results in an error being thrown telling the user to re-run the scan with no branch parameters set, even if no branch analysis parameters were specified. However, when a project is created through the Web interface, SonarQube automatically creates a default branch named `master` which the scanner picks up as the primary branch and targets if no other parameters are specified. This inconsistency means users can't have SonarQube automatically create projects, but have to use the Web interface to set-up any projects first.
      
      To make the setup consistent, the check for no branches existing is extended to also check if any of the branch parameters have also been specified. This way, if no branches exist but no branch parameters were specified then a `DefaultBranchConfiguration` instance is returned which points the analysis at the a default `master` branch which SonarQube will automatically create. Similarly, if no branches exist but a source branch of master is specified then a `DefaultBranchConfiguration` is also returned, providing a target branch either isn't specified or also points at master.
      d02f2488
  13. 14 Mar, 2019 3 commits