with java and php custom rules, I can monitor if these rules are added or not to a project custom quality profile, and then I can have stats on the validation/violation of these rules.
How can I do this with javascript when rules can only be written for ES Lint ?
Sure in my big national âenergy-providingâ company (50 million lines licence almost reached), weâve been asked to work on âGreen ITâ and eco-design around Sonarqube rules. So weâve created a few additionnal âeco-designâ rules for our main languages (java, php and javascript), and now we need to see for each project, how many âeco-designâ rule they use, and how they respect them.
Well, it actually does exist. Itâs just marked as deprecated since Sonarqube 6
Iâm talking about SonarJs custom rules which allow all this.
The question, regarding this need, is still why was it considered âdeprecatedâ, and can this âdeprecationâ (which never transformed into a removing of the feature) be canceled ?
custom rules are deprecated because they were using now removed Java based parser (the feature is really gone). We now use parser based on ESLint. I think we will eventually introduce JS based custom rules, but itâs not on the roadmap right now. You can find some infrastructure for this if you dig in the code, but there are some important pieces still missing.
In https://rules.sonarsource.com/javascript, we can still see many rules, they are done throught ESLint too ? can we do that too, create a rule in ESLint and make it visible in UI like it seems you do ?
The question is indeed why remove the java based parser if it removes rules from UI and make them not visible through quality profiles and APIs :
ESLint may be as good or maybe better in quality/security checking, but it puts javascript behind other languages in term of monitoring rules through Sonarqube UI and APIs.
it seems that my explanation just caused more confusion, sorry for that
We use ESLint as internal library, not directly. All the rules are now implemented using ESLint internally, some of the rules are just plain ESLint rules, some of them we developed ourselves using ESLint framework (usually the more sofisticated rules with data flow analysis are like this).
Java rules had to be removed because maintaining the parser was too much work and did not add any value. Writing rules for JS in JS will allow us to innovate more.
can we do that too, create a rule in ESLint and make it visible in UI like it seems you do ?
eventually perhaps yes, but for the time being this is not possible