Sonar-java ruling test always fails

java
tests

(Jens Bannmann) #1

Hi all,

while working on SonarJava rules, I am struggling with getting the ruling test to run. I believe I followed the instructions in the readme to the letter, but the ruling test always fails, finding differences between actual & expected ruling results in the sonar-server codebase that seem unrelated to the rule I am implementing. So I switched to master (b1bb7b9 at that time) and also tried the 5.9.1.16423 tag plus a few older ones like 4.5.0.8398, but the problem does not go away.

I suspect I am doing something wrong, but I’m out of ideas as to what that might be. I would very much appreciate any pointers!

Best regards,
Jens


mismatching results:

its/ruling/target/actual/sonar-server/squid-JsonWriterNotClosed.json
its/ruling/target/actual/sonar-server/squid-S1711.json
its/ruling/target/actual/sonar-server/squid-S2057.json
its/ruling/target/actual/sonar-server/squid-S2143.json
its/ruling/target/actual/sonar-server/squid-S2187.json
its/ruling/target/actual/sonar-server/squid-S2201.json
its/ruling/target/actual/sonar-server/squid-S2221.json
its/ruling/target/actual/sonar-server/squid-S2259.json
its/ruling/target/actual/sonar-server/squid-S2325.json
its/ruling/target/actual/sonar-server/squid-S2384.json
its/ruling/target/actual/sonar-server/squid-S2638.json
its/ruling/target/actual/sonar-server/squid-S2698.json
its/ruling/target/actual/sonar-server/squid-S2699.json
its/ruling/target/actual/sonar-server/squid-S3242.json
its/ruling/target/actual/sonar-server/squid-S3398.json
its/ruling/target/actual/sonar-server/squid-S3578.json
its/ruling/target/actual/sonar-server/squid-S3864.json
its/ruling/target/actual/sonar-server/squid-S4165.json
its/ruling/target/actual/sonar-server/squid-S4248.json
its/ruling/target/actual/sonar-server/squid-S4449.json
its/ruling/target/actual/sonar-server/squid-S4551.json
its/ruling/target/actual/sonar-server/squid-S4738.json
its/ruling/target/actual/sonar-server/squid-S4784.json
its/ruling/target/actual/sonar-server/squid-S4797.json
its/ruling/target/actual/sonar-server/squid-longDate.json

orchestrator.properties:

# version of SonarQube Server
sonar.runtimeVersion=7.4

orchestrator.updateCenterUrl=http://update.sonarsource.org/update-center-dev.properties

# Location of Maven local repository is not automatically guessed. It can also be set with the env variable MAVEN_LOCAL_REPOSITORY.
maven.localRepository=/Users/jens/.m2/repository
  • I also tried runtimeVersion 6.7 as that one is mentioned in the readme.

Other data:

  • macOS 10.13.6
  • JDK 1.8.0_45
  • Maven 3.5.4 via Homebrew
  • MAVEN_HOME and ORCHESTRATOR_CONFIG_URL are set.

(Michael Gumowski) #2

Hey Jens,

  • Is the ruling always failing on the same rules?
  • Did you checked the differences?
    • Are these new issues?
    • Are these missing issues?
    • Are these rules not raising anything anymore?
  • Are you using the Oracle JDK?
    • Could you try with a more recent version?

I tried playing the ruling of your latest PR on SonarJava on my own machine, and it works fine (Ubuntu 18.04.1 LTS, Maven 3.5.4, Oracle JDK 1.8.0_191).

Michael