AlainODea
(Alain O'Dea)
December 6, 2018, 7:33pm
1
javascript:S138 fires on whole AMD modules unless they are under 200 lines. Lots of our AMD modules are over 200 lines long.
AMD modules (https://requirejs.org/docs/whyamd.html ) look like this:
define(['jquery'] , function ($) {
return function () {};
});
Is there a way to have it pick up functions in general, but exclude AMD module functions?
Lena
(Elena Vilchik)
December 10, 2018, 1:05pm
2
Hello Alain,
Which version of SonarJS do you use? AMD are already ignored in this rule since version 2.6 (released 2.5 years ago)
AlainODea
(Alain O'Dea)
December 10, 2018, 8:18pm
3
Thank you, Elena.
We’re running:
SonarQube Enterprise: 7.4.0.18908
SonarJS: 5.0 (build 6962)
Lena
(Elena Vilchik)
December 13, 2018, 8:12am
4
Ok, probably I know what’s wrong. In your code example you have 2 function expressions. Our rule ignores the outer one only, the inner one is checked as usual. So I expect you are having an undesirable issue on an inner function expression. Please confirm it. Anyway I’m not sure it’s a good idea to have a big returned function.
1 Like
AlainODea
(Alain O'Dea)
December 13, 2018, 7:35pm
5
I get it. It turns out we had a very large Jasmine describe block in one of the files. We can break those up or tactically accept them as wontfix.
Thank you
1 Like