nilsson
(Martin Nilsson)
1
A common pattern in the project I’m analyzing right now is to define object functions in instantly called functions.
function TheClass() { /* init */ }
!function() {
TheClass.prototype.whatever = TheClass_whatever;
function TheClass_whatever() { /* things here */ }
}();
After each such block an S905 bug is raised, despite the code having side effects.
Lena
(Elena Vilchik)
2
Hi,
Which version of SonarJS are you using?
Analyzer should not report when parentheses are used:
function TheClass() { /* init */ }
(function() {
TheClass.prototype.whatever = TheClass_whatever;
function TheClass_whatever() { /* things here */ }
}());
nilsson
(Martin Nilsson)
3
This is the SonarQube Scanner 4.2.0.1873 windows package, connecting to a 8.1 server.
Lena
(Elena Vilchik)
4
So as a workaround you can use ()
instead of !
.
Ticket to support your case -> https://github.com/SonarSource/SonarJS/issues/1931
system
(system)
Closed
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.