Sonarlint Rule Error Message Description Change

Please provide

  • Operating system: Windows 10 Pro
  • SonarLint plugin version: Sonarlint v4.4.1
  • Programming language you’re coding in: C
  • Is connected mode used: No

Question : Is it possible to change the rule’s error messages in settings.json?

Example :
“Rename this function to match the regular expression”
into
“Function name invalid, please change using proper format (e.g. secondary_function)”

Hi,

Welcome to the community!

Sorry, it’s not possible to change this through configuration.

 
Ann

What methods could I try which is possible though?

Hi,

The rule implementation would have to be changed.

 
Ann

1 Like

Could you elaborate on how it would be possible just by changing the Rule Implementation?

Hi,

There’s no “just” to it. It would mean forking the repository to maintain your own version - and keeping up with upgrades as they were released.

 
Ann

1 Like

I see, that works as well, where could I possibly find the file in the Sonarlint Github repository that allows me to change that?

Hi,

It’s not in the SonarLint repo, but in the underlying language analyzer. Going back to your original post, I see we’re talking about C. That analyzer is closed source, and so not available for forking.

 
Ann

I see that response basically wraps up all my questions. Thank you for the responses

Hi @Shawn_Marie_Catana,

Regarding the specific message suggestion, we generally avoid using words like “invalid” in the message description, as they may lead to ambiguity and misinterpretation. For example, when we say the “name is invalid,” it is unclear if it does not abide by the C++ standard rules for identifiers (for example, using @ that is not in the basic character set or using `operator foo’) or if the issue is for not matching format. This is why we chose the current format.

Regarding the question, we currently do provide the ability to customize the rule message for configurable rules in the settings.json file. So this would be a new feature request for all the products. I will share your request with our product manager.

2 Likes