SonarSource / SonarJS

SonarSource Static Analyzer for JavaScript and TypeScript
https://community.sonarsource.com/
GNU Lesser General Public License v3.0
1.04k stars 182 forks source link

[feature request] import existing linting results from files. #726

Closed gucong3000 closed 7 years ago

gucong3000 commented 7 years ago

I want to request a feature.

In the NPM community, we have many very useful linting tools, such as CSSLint EditorConfig ESLint HTMLHint JSCS JSHint Stylelint Standard TSLint XO. I'm trying to put the results of these linting tools in a common file format. But who can i “upload” (so to speak) these results into SonarQube?

I prepared a gulp plugin for this feature. And i prepared some linting results in JSON format.

SonarJS version: Current SonarQube version: Current SonarLint version: Current

gucong3000 commented 7 years ago

Another plugin has a similar plan but I'm not sure that way better. kalidasya/sonar-css-plugin#3 groupe-sii/sonar-web-frontend-plugin#4

vilchik-elena commented 7 years ago

@gucong3000 In fact, if you want to use EsLint in SQ there are some community plugins (e.g. this one https://github.com/sleroy/SonarEsLintPlugin). We are aware of this need for the users, but we are not sure which strategy to take yet.

gucong3000 commented 7 years ago

@vilchik-elena I'm a typical JavaScript programmer. I was involved in the development of Eclint, Stylelint, I am eslint heavy users. What I need is an open generic error report uploads interface. Instead of a sealed box that encapsulates everything

gucong3000 commented 7 years ago

I'm sorry to request this feature here, but your organization shut down all the other ways it.

gucong3000 commented 7 years ago

We are aware of this need for the users, but we are not sure which strategy to take yet.

Can you join me in the discussion? Mailing lists or other channels.

inverno commented 7 years ago

Hi @gucong3000 I think that here is perfectly fine to have a discussion, but you raise many points and I'll first try to contact you directly so that we can have a more speedy conversation over chat or voice.

gucong3000 commented 7 years ago

@inverno Thanks, All I need are:

gucong3000 commented 7 years ago

I think JavaScript developers will not like Sonar to static analysis their code. they prefer linters (ESLint, TSLint, Standard...) to do it. Sonar shouldn't be doing what not good at.

inverno commented 7 years ago

@gucong3000, I'll forget for a moment the tone of your messages so far and answer to your questions, rather than your presumptousness.

I of course disagree with you on Sonar not being good at static analysis (I presume you mean SonarJS and not SonarQube, otherwise you are mixing an analyzer with a code quality platform), it's in fact much more advanced than your average linter. The fact is that SonarJS and ESLint are good at different things right now: ESLint is a very extensible analyzer, it has good integration with the JS ecosystem and great support for best-practices and style-related rules over multiple frameworks (especially thanks to its extensibility), on the other hand SonarJS is much better at finding non-trivial problems in your code (you'll notice that it takes time, even when pointed to it, to find out why the notxml variable will always be true in that condition). This is because we invested heavily in developing the underlying code models, which is not unique, but pretty rare.

Then, here is a very good place to request features for SonarJS, if you want to request features for SonarQube you can go to the sonarqube google group. I don't get why you say that 'our organization' shut down ways for you to request features.

Finally, I don't get the reason for your rant in the first place : @vilchik-elena pointed you to a SonarQube plugin that allows you to do exactly what you seem to want to do (import an eslint report). Did you at least try it? I suggest you do, and I also suggest that maybe you give a try to SonarJS, especially using it in SonarLint and keeping the default, very low noise profile that focuses on bug-finding.

gucong3000 commented 7 years ago

Please ignore my tone and all the information you see comes from Bing translation

gucong3000 commented 7 years ago

The biggest problem with machine translation is that it doesn't respond correctly, and if that makes two angry, I should apologize for it

gucong3000 commented 7 years ago

What I'm doing is not going to be one of my projects, using sonar to analyze the project, what I'm going to do is a middleware to report the various lint results in the front-end ecology to sonar https://github.com/gucong3000/gulp-reporter

gucong3000 commented 7 years ago

Let Java developers developed tools, to analyze the work of JS developers, it is difficult to poke their pain points, will be wasted I think the reasonable solution should be to allow users to use the tools they are familiar with. Allow users to submit their own reports to sonar

gucong3000 commented 7 years ago

No one can develop a universal tool unless the tool is like a Lego building block that can be replaced with random parts SonarJS can't satisfy everyone at the same time unless grammar analysis engine is free to replace it. Rules can be configured arbitrarily

gucong3000 commented 7 years ago

I'm still looking for ways to import existing linting results.

inverno commented 7 years ago

@gucong3000 did you try https://github.com/sleroy/SonarEsLintPlugin ?

gucong3000 commented 7 years ago

did you try https://github.com/sleroy/SonarEsLintPlugin ?

No. I just read the document and a little code.

In addition, my appeal is to import linting results, rather than using ESlint I want my gulp plugin can export results (more than 8 kind of linting tools) to SQ

gucong3000 commented 7 years ago

Linting tools I'd like to compatible: CSSLint EditorConfig ESLint HTMLHint JSCS JSHint stylelint Standard TSLint XO

I'm trying to put the results of these linting tools in common file format.

gucong3000 commented 7 years ago

Also, I forgot one thing, I am using SonarCloud with Travis CI. I don't have permission to install SonarEsLintPlugin