Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonar js plugin + web frontend plugin doesn't work #22

Open
aurelien-baudet opened this issue Feb 9, 2016 · 11 comments
Open

Sonar js plugin + web frontend plugin doesn't work #22

aurelien-baudet opened this issue Feb 9, 2016 · 11 comments

Comments

@aurelien-baudet
Copy link
Member

In order to see linters results in Sonar, I must uninstall the javascript plugin from Sonar and then run the analyzer. I can't have both javascript base plugin and your javascript plugin enabled.
And I'd like to keep my reports from the javascript plugin from Sonar...
What could be the best way to do so ? (not to have two projects for one and install/uninstall plugins)
Thanks.

@aurelien-baudet
Copy link
Member Author

I added some configuration parameters to make both plugins work together. If the Sonar javascript plugin is present you can add the following properties (in sonar-project.properties or change project configuration values directly in Sonar web interface):

# disable computation of number of lines by the plugin and let Sonar javascript plugin doing it
sonar.sii.quality.js.file.metrics.skip=true
sonar.sii.quality.angular.file.metrics.skip=true
sonar.sii.quality.eslint.angular.file.metrics.skip=true

# disable computation of duplications by the plugin and let Sonar javascript plugin doing it using CPD
sonar.sii.duplication.js.skip=true

I have also added the same configuration values for other languages (html, css, scss) in prevision of future Sonar plugins:

sonar.sii.quality.html.file.metrics.skip=true
sonar.sii.quality.css.file.metrics.skip=true
sonar.sii.quality.scss.file.metrics.skip=true

sonar.sii.duplication.html.skip=true
sonar.sii.duplication.css.skip=true
sonar.sii.duplication.scss.skip=true

Then, to make Sonar display both Sonar javascript plugin issues and our plugin issues, you have to configure a profile that contains the rules you want.

Finally, just run another analysis with the newly created profile.

That's all.

@yanzacheus can you try to build the plugin, run it following these instructions and tell me if it is ok for you ?

Thanks

@yanzacheus
Copy link

Sorry, but it did'nt work.
I built the plugin with your new commit, reinstalled it, added the properties in the sonar-project.properties file of my project, and launched sonar-runner.
But I can't see the eslint-angular plugin results.
I saw that in the quality profiles page, you can't assign both eslint-angular and sonar way to the same project, so I also tried to set it to All linters, and all the rules are applied.
But it does'nt seem to change anything, and quality profile remains Sonar way in the main dashboard of the project after the analysis.

If I remove the one or the other, it works but with both I can see in the log of the task:
2016.02.09 20:40:39 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVLHjLqTJcL9uZ8ngym0
java.lang.IllegalArgumentException: Multiple entries with same key: js=JavaScript and js=JS

For the version 4.5, it seemed to be ok, but in this version, you can't have the files edition feature.
Thanks again.

@aurelien-baudet
Copy link
Member Author

As you said, it works well with Sonar 4.5.5 but it doesn't work with 5.3.

There were many changes in Sonar. When both plugins are activated, the runner says "EXECUTION SUCCESS". But Sonar 5.3 introduces a queue that temporarily stores results of runner execution. This temporary report is later parsed and information is stored after that. So even if the message is "EXECUTION SUCCESS" in logs of runner, in fact a log for parsing runner report says:

2016.02.09 23:11:32 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVLIFssKMknfTONm_V08
java.lang.IllegalArgumentException: Multiple entries with same key: js=JavaScript and js=JS
        at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150) ~[guava-17.0.jar:na]
        at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104) ~[guava-17.0.jar:na]
        at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70) ~[guava-17.0.jar:na]
        at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254) ~[guava-17.0.jar:na]
        at com.google.common.collect.Maps.uniqueIndex(Maps.java:1166) ~[guava-17.0.jar:na]
        at com.google.common.collect.Maps.uniqueIndex(Maps.java:1140) ~[guava-17.0.jar:na]
        at org.sonar.server.computation.language.LanguageRepositoryImpl.<init>(LanguageRepositoryImpl.java:46) ~[sonar-server-5.3.jar:na]

So when both are present at the same time nothing is updated at all. It keeps the last values from previous analysis with only one of the plugins.

It seems that it is now impossible to have two plugins that are able to handle the same language. For the moment I have no idea how to enable both plugins at the same time.

I will ask support from Sonar to know if it is still possible.

@yanzacheus
Copy link

Ok thanks, I'll keep an eye on it

@aurelien-baudet
Copy link
Member Author

Sonar has answered about multiple plugins to handle one language and it is no more possible.

So you can't have both our plugin and Sonar JS plugin installed at the same time.

But, I also added their plugin into ours. So it is now possible to have our rules and theirs.
It is available in branch test/include-sonar-js.

Can you test it and tell me if it is ok for you ?

Thanks

@yanzacheus
Copy link

Ok thanks for the info.
Does it mean that I also need to use all the reporters from
sonar-web-frontend-reporters ?
Because till now , I merged all the lcov files generated into a
mergeLcov.info, and noticed that in the sonar-project.properties file like
this :
sonar.javascript.lcov.reportPath=./mergeLcov.info

2016-02-22 13:33 GMT+01:00 Aurélien Baudet [email protected]:

Sonar has answered about multiple plugins to handle one language and it is
no more possible.

So you can't have both our plugin and Sonar JS plugin installed at the
same time.

But, I also added their plugin into ours. So it is now possible to have
our rules and theirs.
It is available in branch test/include-sonar-js.

Can you test it and tell me if it is ok for you ?

Thanks


Reply to this email directly or view it on GitHub
#22 (comment)
.

@aurelien-baudet
Copy link
Member Author

You can also use the following properties:

sonar.sii.coverage.ut.js.report.path=<path to unit tests coverage>
sonar.sii.coverage.it.js.report.path=<path to integration tests coverage>
sonar.sii.coverage.overall.js.report.path=<path to whole tests coverage>

You can use only one of them or all at the same time depending on coverage files you have.
It should work with your own lcov file if it is standard

@yanzacheus
Copy link

Thanks, it works.
Nevertheless...

  1. even if I only set sonar.sii.coverage.it.js.report.path, it also
    processes ut and overall reports (about 5 min each one)
  2. I can have both your rules and theirs in the same analysis using
    inheritance (setting the quality profile of the project to eslint-angular,
    and changing parent of this profile to Sonar Way)
    Without inheritance, rules are removed according to the quality profile
    (and All linters does'nt gather sonar way and eslint-angular set of rules)

2016-02-23 8:06 GMT+01:00 Aurélien Baudet [email protected]:

You can also use the following properties:

sonar.sii.coverage.ut.js.report.path=
sonar.sii.coverage.it.js.report.path=
sonar.sii.coverage.overall.js.report.path=

You can use only one of them or all at the same time depending on coverage
files you have.
It should work with your own lcov file if it is standard


Reply to this email directly or view it on GitHub
#22 (comment)
.

@SandhyaBee
Copy link

SandhyaBee commented Jul 4, 2016

Hi @aurelien-baudet , this doesn't work for me. I have set project's quality profile as eslint-angular , but it doesnt report any issues. I have added those properties to the property file. I use sonar 4.5.5.

@carlosmmelo
Copy link

@aurelien-baudet have you guys tried this fix: RadoBuransky/sonar-scoverage-plugin#31

@RachithaBR
Copy link

RachithaBR commented Jan 10, 2017

Hi.. I started working on analyzing angularJS projects in sonar. Hence I installed sonar-web-frontend-plugin. I have disabled the sonar-javascript-plugin since it was showing "java.lang.IllegalArgumentException: Multiple entries with same key: js=JavaScript and js=JS" error. When i run the analysis using "sonar-scanner" command in command prompt, I get "Execution success". But in sonar dashboard I m not able to analyse project and I get "Project is not analyzed yet" message.

My sonar-project.properties file looks like this:

sonar.language=js
sonar.profile=eslint-angular
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.tests=test
sonar.sii.coverage.ut.js.report.path=reports/coverage/report-lcov/lcov.info

How will I be able to analyse the project in sonar?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants