Adding "TODO, FixMe comments" rule to TypeScript

Just curious if there’s a way to add an existing rule from one language to another? Some of the languages have a rule to search for “TODO, FixMe comments”, which seems general enough to work with any language, but this rule isn’t available for TypeScript. Is there a way that we can add this rule to TypeScript (Code Smell)?

Hi,

Welcome to the community!

You’ve posted this in the ‘Writing rules’ category, so I guess you’re willing to do the work yourself. But unfortunately, TypeScript isn’t a language where we support custom rules. So unfortunately you would have to implement it outside of SonarQube, run the tool before analysis, convert its output to the Generic Issue Report format (it it wasn’t already in that format) and import the report during analysis.

And I’m going to ping the language team so they’re aware of the interest in writing custom rules for TS.

 
Ann

Hey U84six,

Rule S1135 is available for JS and TS. Would you be interested in the S1707 rule which checks if someone is referenced or did you have something else in mind?

Best,
Ilia

Hi ilia,

I know it has been a while. You’ve pointed out that the rule S1135 (“TODO”) is available for TypeScript, but I don’t see it in my version of Sonarqube version 7.6. How would I get this rule into my version of SQ for TypeScript? If I click on Rules at the top and select JavaScript, I see that it’s available for that, but when I click on TypeScript, it’s not in the list to enable. Also, regarding your question about S1707, that rule would help too

Thanks

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.6 → 7.9.6 → 8.9.10 → 9.9.2 → 10.2.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Once you’ve upgraded, you should see the rule.

 
HTH,
Ann

Yes, thank you. After I replied to this, I found a post about the 30+ new rules for TypeScript and S1135 was included in 8.2 :upside_down_face: