Reduce number of lines for some issues

I am using the SonarLint plugin for VS code with bindings to our own Sonarqube instance.

We have a bunch of old, long-grown files which unfortunately exceed our rules for max line length per file, max line length per function, and max function complexity.

This leads to very ugly renderings of those files / functions due to everything being underlined from the first character position to the last.

Screenshot 2020-01- 8, 15.35.51

(If it’s not clear from the obsfuscated source code, hopefully the minimap should give it away.)

The number of characters to be underlined seems to come from the Sonarlint plugin:

	"resource": "/path/to/file.js",
	"owner": "sonarlint",
	"code": "javascript:S138",
	"severity": 4,
	"message": "function has too many lines (2293). Maximum allowed is 200.",
	"source": "sonarlint",
	"startLineNumber": 1,
	"startColumn": 8,
	"endLineNumber": 3023,
	"endColumn": 2

Please note the huge endLineNumber value (3023). Would it be possible to decrease this value for this issue and similar ones? E.g. the warning only spans a few lines or only the function name?

Of course did I try to change the errorWarning.foreground color or just mute the whole underline / warning output in the VS Code settings. But I think this misses the point. I still should be (and want to be) made aware of the issue. to one day refactor for less length and complexity. However, it will not happen sooner when the whole code becomes harder to read, and I am probably even missing graver issues somewhere in this yellow-curled nightmare.

What do you think?


Name: SonarLint
Id: sonarsource.sonarlint-vscode
Description: SonarLint is an IDE extension that helps you detect and fix quality issues as you write code in JavaScript, TypeScript, Python and PHP.
Version: 1.13.0
Publisher: SonarSource
VS Marketplace Link:

VS Code

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T15:04:31.999Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 4.19.91-1-MANJARO

Hi @p3k

This issue has been resolved with recent versions of the SonarJS analyzer. Only the function signature is now highlighted. Please ask your SonarQube administrator to update the SonarJS plugin on the SonarQube server, then update your binding in SonarLint.


1 Like

thanks a lot for the advice, julien.

from our point of view the sq instance is running with version 6.1.0 of the plugin:


i restarted vs code, updated the bindings multiple times, and i am quite positive the update works because i enabled a new rule and it appeared in the editor.

nevertheless, i still get the full file undercurled due to endLineNumber set to the max.

any further idea what could be missing?

Can you open the SonarLint output, clear it, then trigger an update of the binding. Logs should contain the version of the plugin. For example I have:

Create : /home/julien/.sonarlint/plugins
Plugin cache: /home/julien/.sonarlint/plugins
Create : /home/julien/.sonarlint/plugins/_tmp
Load plugins
Load plugins (done) | time=44ms
  * License for SonarLint (license)
  * SonarPython (python)
  * SonarHTML (web)
  * SonarPHP (php)
  * SonarTS (typescript)
  * SonarApex (sonarapex)
  * SonarJS (javascript)
  * SonarPLSQL (plsql)
[Info  - 16:13:53] Using storage for server 'next' (last update 22/11/2019 12:08)
Connected SonarLint engine started for 'next'

same version as above, 6.1.0:

Create : /home/tobi/.sonarlint/plugins
Plugin cache: /home/tobi/.sonarlint/plugins
Create : /home/tobi/.sonarlint/plugins/_tmp
Load plugins
Load plugins (done) | time=2ms
  * SonarPHP (php)
  * SonarPython (python)
  * SonarTS (typescript)
  * SonarHTML (web)
  * SonarJS (javascript)
[Info  - 4:18:48 PM] Using storage for server '…' (last update 1/13/20 4:18 PM)

My bad, I was in fact testing with an older version of SonarJS. So this is the opposite: it is a regression of latest 6.x versions, that are now based on the max-lines-per-function ESLint function. I will see with my teammates what can be done.

Thanks again for the feedback!

1 Like

thank you too for your kind assistance :smiley_cat:

in the meantime i found this issue, maybe useful.

1 Like

Good catch, that’s the one. I should have searched open issues in the first place :sweat_smile:

Hello @p3k and @Julien_HENRY,

I agree that this is far from ideal, it’s ugly not only in Sonarlint, but also in the UI.
I’m happy to tell you that we tackled the issue recently! In addition, we spotted and improved the highlighting of two others rules. (in the dev version though, not in a released one).

Thanks again for the feedback, feel free to raise the hand if you notice other poor highlighting!



that’s great news, quentin!

thanks for your response and the swift implementation of sonarlint’s own rule. when do you think these changes are going to be released?


@Quentin i see the commit went into master recently but i am not sure there is an “official” release of 6.2, yet… any updates? would be really glad to get rid of this underline hell :wink: