I have this class to start up the spring-cloud config server. It is a spring-boot application.
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigServerApplication {
public static void main( String[] args ) {
SpringApplication.run( ConfigServerApplication.class, args );
}
}
The application runs fine and all my unit tests are fine. However, in our bamboo pipeline, it will initial a sonar process
to analyze the code. We keep getting these minor warnings indicating the following:
Utility classes should not have a public constructor
I know that this is a minor issue, but I have been tasked with removing these from our code.
Ideally, you would mark the class final and provide a private constructor, or so all searches provide as a solution. However, a Spring Configuration class cannot be made final and cannot have a private constructor.
Can Sonar be modified to not include spring-boot application classes (and configuration classes) from being reported as Utility classes, especially if there is a public static void main method in the class?
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/BY2PR0701MB1973605DF51EC3DEBBF9208CEB420%40BY2PR0701MB1973.namprd07.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Thanks for the update Freddy.
I was only asking because I was tasked with cleaning up the sonar reported issues. I will see if I can relax the rules around these types of classes to eliminate these minor warnings from appearing.
Dan
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/3bc49eca-341c-4167-b933-4ffbaa34779d%40googlegroups.com.