False positive (javascript:S100): Rule in violation with ReactJS component naming conventions

202 views
Skip to first unread message

alix....@gmail.com

unread,
Dec 20, 2017, 4:00:13 AM12/20/17
to SonarQube
Hi,

we've noticed that a rule, "Function and method names should comply with a naming convention" (javascript:S100), causes violations in a ReactJS code base as component names need to start with a capital letter (otherwise doesn't work: https://stackoverflow.com/questions/30373343/reactjs-component-names-must-begin-with-capital-letters ).
This seems like a false positive. Could SonarQube maybe try to identify React components and exclude them for this rule?

Elena Vilchik

unread,
Dec 26, 2017, 5:15:52 AM12/26/17
to SonarQube
Hi,

This rule has the parameter "format", so you should just configure it the way it makes sense for your code base.

Regards,
Elena

alix....@gmail.com

unread,
Jan 31, 2018, 7:57:17 AM1/31/18
to SonarQube
Hi Elena,

Thank you for your suggestion but it does not help us much in this case.
We want to stick with the standard naming convention for methods but would like to have exceptions for the ReactJS components (that are built as methods) as the standard naming convention is not compatible with this particular component.
One way of doing that is for the JS engine to recognize ReactJS and not apply this naming convention rule for this type of component (it must use a specified name in order to work). 
What do you think is the best way forward?

/ Alix

Elena Vilchik

unread,
Jan 31, 2018, 10:33:27 AM1/31/18
to SonarQube
Hi,


Elena
Reply all
Reply to author
Forward
0 new messages