Backelite / sonar-objective-c

Sonar Plugin for Objective-C
197 stars 75 forks source link

Integrate oclint 0.13 rules #46

Open svendr opened 6 years ago

svendr commented 6 years ago

As stated in #45, the plugin doesn't work well with oclint 0.13 and therefore with Xcode9. The ruleset should be updated to match the latest versions on http://docs.oclint.org/en/stable/rules

Executing groovy updateOCLintRules.groovy should be sufficient

Nagesh-Chandan commented 6 years ago

@svendr even after following all the steps you mentioned, I'm still getting 'The rule 'OCLint:compiler warning' does not exist.' error. --info--

CoreOne23 commented 6 years ago

@Nagesh-Chandan , @svendr Any updates on this issue? I 'm still getting the error even after following the steps.

CoreOne23 commented 6 years ago

The temp solution worked for me is to remove the tags from the oclint.xml file with rule= "compiler warning"

svendr commented 6 years ago

Yeah the generic "compiler warning" rule causes all kinds of trouble. You have to get rid of it.

Alternatively you can checkout the branch I developed my PR on, build the plugin-jar with it and deploy it to your sonar-server.

see https://github.com/svendr/sonar-objective-c/tree/feat/oclint-0.13-support

Just run SONARQUBE_HOME=XXX sh build-and-deploy.sh from the root folder

zippy1978 commented 6 years ago

Hi @svendr,

Support for OCLint 0.13 is now in release 0.6.2 of the plugin.

Let me know if it okay now.

Regards, Gilles

zhoujihang commented 6 years ago

it doesn't work well with oclint 0.13 in release 0.6.2 of the plugin, and run-sonar.sh file contains many merge conflicts in tag 0.6.2 @zippy1978

env: xcode 9.1 Java 1.8.0_60 Sonar 6.7 Sonar-scanner 3.0.3.778 OCLint 0.13

error info: .ERROR: Error during SonarQube Scanner execution ERROR: The rule 'OCLint:compiler warning' does not exist. ERROR: ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. ERROR - Command 'sonar-scanner ' failed with error code: 1

CoreOne23 commented 6 years ago

For those who looking for temp solution, I used the following py code to remove the warnings from the xml file. First run sh run-sonar.sh -v , then run the below script on created xml file.

import xml.etree.ElementTree as ET
tree = ET.parse('oclint.xml')
root = tree.getroot()
for File in root.findall('file'):
    if File[0].get('rule') == 'compiler warning':
        print File[0].get('rule')
        root.remove(File)
tree.write('oclint.xml')

and last, run sonar-scanner.

FlyingTux123 commented 6 years ago

I have trouble too with the OClint rules. However the workaround in #45 works temporary for me, but the next issue with the rule set is right here.

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 13.302s
Final Memory: 13M/395M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: The rule 'OCLint:avoid private static members' does not exist.
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
++ returnValue=1
++ set +x

The mentioned rule above is present in OCLint since version 0.10.1 (Rule Overview: http://oclint-docs.readthedocs.io/en/stable/rules/design.html). Is there another work around or a new update in the line ?

FlyingTux123 commented 6 years ago

Found a solution to avoid the trouble. Adding -disable-rule=AvoidPrivateStaticMembers to the run-sonar.sh script did the trick.

gretzki commented 6 years ago

This PR https://github.com/Backelite/sonar-objective-c/pull/50 solves it. Works on my machine 👍