How do I pass a custom rule for SonarQube to define JavaScript constructors?

I've worked with MVC client side like Angular JS. I am part of a project, I wrote several services to handle client requests and responses using Angular Api. I am currently doing some code quality tasks using the SONAR Tool. But according to Angular the JS Api service has one function that we can call it as a constructor with the same service name. for example

            angular.module('modulename').factory('ServiceName',[function(){
            function ServiceName() { }]);

      

Now release with SonarQube. SonaQube reads this function name as a normal function name (serviceName) based on some normal Hungarian notation rules, but if I change this function name as a normal function name then the functionality does not work according to the Angular JS Api standard. So now I need to pass one custom SONAR rule to exclude the validation of this constructor name as a normal function name. So who can suggest me any ways to write my own rule to handle such scenarios. Thank you in advance?

+3


source to share





All Articles