New Javascript Rule for naming functions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

New Javascript Rule for naming functions

Sylvain Jeandroz
Hi everybody,

First congratulation for the product, it is very great!

I have a suggestion for create a new Javascript rule or update the rule "Function names should comply with a naming convention":

Some of my developers do not respect naming conventions for naming functions, most of time they define functions like this:

onTextfieldChange1111111: function(field, newValue, oldValue, eOpts) {
...
}

And it looks like this method doesn't fire the rule "Function names should comply with a naming convention".

After asking this question on StackOverflow (http://stackoverflow.com/questions/29937532/sonarqube-javascript-rule-function-names-should-comply-with-a-naming-convention), it looks like this rule doesn't check functions that are defined like this, it only check functions defined like:

function onTextfieldChange1111111(....){


I think this is almost a bug, because this way of naming functions is correct in Javascript, so this rule should works.

Thanks in advanced for your help and sorry for my bad english...


Best regards
--

Sylvain Jeandroz
CEO-Vision
<a style="color:#999999;" href="callto:+33668452095">+33 6 68 45 20 95
[hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New Javascript Rule for naming functions

Linda Martin
Hello Sylvain,

Thank you for your feedbacks!

The following ticket has been created SONARJS-430 in order to extend the rule 
to  cover: variable, function and object properties.

Thanks,

Best regards,

Linda.

On 29 April 2015 at 12:07, Sylvain Jeandroz <[hidden email]> wrote:
Hi everybody,

First congratulation for the product, it is very great!

I have a suggestion for create a new Javascript rule or update the rule "Function names should comply with a naming convention":

Some of my developers do not respect naming conventions for naming functions, most of time they define functions like this:

onTextfieldChange1111111: function(field, newValue, oldValue, eOpts) {
...
}

And it looks like this method doesn't fire the rule "Function names should comply with a naming convention".

After asking this question on StackOverflow (http://stackoverflow.com/questions/29937532/sonarqube-javascript-rule-function-names-should-comply-with-a-naming-convention), it looks like this rule doesn't check functions that are defined like this, it only check functions defined like:

function onTextfieldChange1111111(....){


I think this is almost a bug, because this way of naming functions is correct in Javascript, so this rule should works.

Thanks in advanced for your help and sorry for my bad english...


Best regards
--

Sylvain Jeandroz
CEO-Vision
<a style="color:#999999" href="callto:+33668452095" target="_blank">+33 6 68 45 20 95
[hidden email]


Loading...