openhab / static-code-analysis

Maven tooling for static code analysis
https://www.openhab.org/
Other
32 stars 23 forks source link

Checks not working on Travis #47

Closed kaikreuzer closed 7 years ago

kaikreuzer commented 7 years ago

As The Jenkins PR builder has memory issues with activated checks, I tried out Travis instead.

There, the builds run through nicely, without any memory issues. Unfortunately, they seem to be "too green" - almost every PR has succeeded and if I look at the logs, it seems as if the check result files are missing:

[INFO] --- static-code-analysis:0.0.3:report (default) @ org.openhab.binding.rme ---
Error 
  java.io.FileNotFoundException:
  /home/travis/build/openhab/openhab2-addons/addons/binding/org.openhab.binding.rme/target/code-analysis/checkstyle-result.xml (No such file or directory)
[ERROR] java.io.FileNotFoundException: /home/travis/build/openhab/openhab2-addons/addons/binding/org.openhab.binding.rme/target/code-analysis/checkstyle-result.xml (No such file or directory)
Error 
  SXXP0003: Error reported by XML parser: Premature end of file.
[ERROR] org.xml.sax.SAXParseException; Premature end of file.
Error 
  SXXP0003: Error reported by XML parser: Premature end of file.
[ERROR] org.xml.sax.SAXParseException; Premature end of file.
Error 
  SXXP0003: Error reported by XML parser: Premature end of file.
[ERROR] org.xml.sax.SAXParseException; Premature end of file.
[Fatal Error] :-1:-1: Premature end of file.
[WARNING] Cann't select /sca/file/message nodes from /home/travis/build/openhab/openhab2-addons/addons/binding/org.openhab.binding.rme/target/code-analysis/20946993_SecondMerge.xml. Empty NodeList will be returned.
...

Furthermore, it seems to miss some other of our recent changes as I see things like

[WARNING] Unable to locate Source XRef to link to - DISABLED

and

[INFO] Fork Value is true

Any idea what might be wrong on Travis?

svilenvul commented 7 years ago

[INFO] There are 2291 errors reported by Checkstyle 7.2 with sun_checks.xml ruleset.

Our rulesets are not used at all (and the tool falls back to the default sun_checks.xml).

All the changes that are missing and you have mentioned above should be applied as user properties here and here. Travis is not OK with these lines.

kaikreuzer commented 7 years ago

Travis is not OK with these lines.

What do you mean by this? That it does not see the properties?

FYI: Please not this change that I did, could that be related in any way? Do I have to activate check-bundles profile as well? I don't think so, because it should work based on existence of MANIFEST, right?

martinvw commented 7 years ago

Note that there was similar report at the community forum, but running locally:

https://community.openhab.org/t/static-code-analysis-tool/24489/44

Also, I see the following when I add '--debug' to the mvn command above: [DEBUG] request.getConfigLocation() sun_checks.xml which makes me believe the rules.xml file from the jar is being ignored as well.

And my local build-server also fails to run the checks properly, I run teamcity with Maven 3.0.5. And my Windows development server runs maven 3.3.9.

As a test I upgraded my build server to run with 3.3.9 as well.

svilenvul commented 7 years ago

I don't think so, because it should work based on existence of MANIFEST, right?

Yes, exactly.

What do you mean by this? That it does not see the properties?

I am not sure what exactly happens, but it is related with the properties.

svilenvul commented 7 years ago

As a test I upgraded my build server to run with 3.3.9 as well.

Thanks.

martinvw commented 7 years ago

That might work more-or-less:

[Step 1/3] [INFO] --- static-code-analysis:0.0.3:report (default) @ org.openhab.binding.homematic ---
[09:57:48][Step 1/3] [INFO] Individual report appended to summary report.
[09:57:48]
[Step 1/3] Failed to execute goal org.openhab.tools:static-code-analysis:0.0.3:report (default) on project org.openhab.binding.homematic: Code Analysis Tool has found 29 error(s)! 
Please fix the errors and rerun the build. 
Errors list: 
ERROR found by findbugs: org.openhab.binding.homematic.discovery.HomematicDeviceDiscoveryService$1.java:113 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicBridgeHandler.java:194 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicBridgeHandler.java:320 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicBridgeHandler$1.java:86 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:142 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:184 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:189 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:191 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:196 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:238 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler.java:395 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.handler.HomematicThingHandler$1.java:113 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.java:243 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.java:691 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.java:801 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway$EventTrackerThread.java:825 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway$EventTrackerThread.java:826 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway$ReconnectThread.java:903 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.message.BinRpcMessage.java:241 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.java:68 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.BinRpcCallbackHandler.java:101 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.BinRpcServer.java:60 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.XmlRpcServer.java:89 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.XmlRpcServer$ResponseHandler.java:121 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.communicator.server.XmlRpcServer$ResponseHandler.java:153 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.misc.DelayedExecuter$1.java:55 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.internal.misc.MiscUtils.java: 
      Logger should be non-static field. Change this field (logger) to non-static field.

ERROR found by findbugs: org.openhab.binding.homematic.type.HomematicTypeGeneratorImpl.java:329 Format should be constant. Use placeholder to reduce the needless cost of parameter construction. see http://www.slf4j.org/faq.html#logging_performance 
ERROR found by findbugs: org.openhab.binding.homematic.type.MetadataUtils.java: 
      Logger should be non-static field. Change this field (logger) to non-static field.

Detailed report can be found at: file////opt/buildagent/work/5c3cd640ded15833/addons/binding/org.openhab.binding.homematic/target/code-analysis/report.html

The build however fails at Homematic and does not continue after that, maybe i'm some commits behind:

[09:57:48][Step 1/3] [INFO] ------------------------------------------------------------------------
[09:57:48][Step 1/3] [INFO] Reactor Summary:
[09:57:48][Step 1/3] [INFO] 
[09:57:48][Step 1/3] [INFO] openHAB ............................................ SUCCESS [  0.289 s]
[09:57:48][Step 1/3] [INFO] openHAB Add-ons .................................... SUCCESS [  0.009 s]
[09:57:48][Step 1/3] [INFO] openHAB Bindings ................................... SUCCESS [  0.010 s]
[09:57:48][Step 1/3] [INFO] AirQuality Binding ................................. SUCCESS [ 17.769 s]
[09:57:48][Step 1/3] [INFO] AllPlay Binding .................................... SUCCESS [  6.541 s]
[09:57:48][Step 1/3] [INFO] Amazon Dash Button Binding ......................... SUCCESS [  6.758 s]
[09:57:48][Step 1/3] [INFO] Astro Binding ...................................... SUCCESS [  9.426 s]
[09:57:48][Step 1/3] [INFO] Atlona Binding ..................................... SUCCESS [ 11.670 s]
[09:57:48][Step 1/3] [INFO] Autelis Binding .................................... SUCCESS [  5.392 s]
[09:57:48][Step 1/3] [INFO] AVM FRITZ! Binding ................................. SUCCESS [  6.983 s]
[09:57:48][Step 1/3] [INFO] BoschIndego Binding ................................ SUCCESS [  5.120 s]
[09:57:48][Step 1/3] [INFO] Chromecast Binding ................................. SUCCESS [  5.404 s]
[09:57:48][Step 1/3] [INFO] CoolMasterNet Binding .............................. SUCCESS [  5.408 s]
[09:57:48][Step 1/3] [INFO] DSCAlarm Binding ................................... SUCCESS [ 10.438 s]
[09:57:48][Step 1/3] [INFO] Exec Binding ....................................... SUCCESS [  5.277 s]
[09:57:48][Step 1/3] [INFO] openHAB I/O Add-Ons ................................ SUCCESS [  0.009 s]
[09:57:48][Step 1/3] [INFO] Transport Feed bundle .............................. SUCCESS [  0.456 s]
[09:57:48][Step 1/3] [INFO] Feed Binding ....................................... SUCCESS [  4.911 s]
[09:57:48][Step 1/3] [INFO] Feed Binding Tests ................................. SUCCESS [  8.012 s]
[09:57:48][Step 1/3] [INFO] Folding Binding .................................... SUCCESS [  5.470 s]
[09:57:48][Step 1/3] [INFO] Freebox Binding .................................... SUCCESS [  7.545 s]
[09:57:48][Step 1/3] [INFO] Gardena Binding .................................... SUCCESS [  7.318 s]
[09:57:48][Step 1/3] [INFO] HarmonyHub Binding ................................. SUCCESS [  6.502 s]
[09:57:48][Step 1/3] [INFO] HDanywhere Binding ................................. SUCCESS [  5.495 s]
[09:57:48][Step 1/3] [INFO] Hunter Douglas PowerView Binding ................... SUCCESS [  5.830 s]
[09:57:48][Step 1/3] [INFO] Homematic Binding .................................. FAILURE [ 14.032 s]
martinvw commented 7 years ago

Note that travis does indeed run on:

Apache Maven 3.2.5

https://docs.travis-ci.com/user/ci-environment/#Maven-version

martinvw commented 7 years ago

With an up-2-date master and my build-server on 3.3.9 I have a green build 👍

With the correct report.

Most of the time things like this are caused by maven picking default version of plug-ins (different in different maven versions) when you did not specify them, but a quick check revealed that it seems that only the compiler plug-in has no specific version, imho not really the main suspect.

kaikreuzer commented 7 years ago

So shall we try https://github.com/travis-ci/enterprise-installation/issues/14#issuecomment-273746437 or is there a better way to get to a more recent Maven version on Travis?

martinvw commented 7 years ago

According to the docs not I fear

kaikreuzer commented 7 years ago

Trying it, let's touch wood: https://travis-ci.org/openhab/openhab2-addons/builds/218034637

kaikreuzer commented 7 years ago

Success! Let's see if this will make other PRs fail that don't comply to the guidelines.