I am using Sonarlint with VSCode on a Java project on Windows 10. My project has a variable naming convention such that we use underscores as long as it isn't the first character. These variables are triggering Java Rule S116 "Field names should comply with a naming convention". The doc on this rule says that the default regex it uses is '^[a-z][a-zA-Z0-9]*$' It also says:
Parameters Following parameter values can be set in the SonarLint:Rules user settings. In connected mode, server side configuration overrides local settings.
format Regular expression used to check the field names against. (Default value: ^[a-z][a-zA-Z0-9]*$)
This strongly implies that the value of the regex can be changed by the user and that it can be done with local configuration. But I can't figure out from this information what exactly do I do to change the value. Any ideas?
CodePudding user response:
In the settings GUI find the setting for this extension and change it to
^[a-z][a-zA-Z0-9_]*$
CodePudding user response:
There wasn't a place in the setting GUI for this, but it can be set in the user (not workspace) settings.json file, by adding this entry:
"sonarlint.rules": {
"java:S116": {
"parameters": {
"format": "^[a-z][a-zA-Z0-9_]*$"
}
}|
}
