Sonarqube vs cast1/1/2023 Public class MyFirstCustomCheck extends IssuableSubscriptionVisitor Override public List nodesToVisit() In folder /src/test/files, create a new empty file named MyFirstCustomCheck.java, and copy-paste the content of the following code snippet.To create our first custom rule (usually called a " check"), let's start by creating these 3 files in the template project, as described below: A rule class, which contains the implementation of the rule.A test class, which contains the rule's unit test.A test file, which contains Java code used as input data for testing the rule.When implementing a rule, there is always a minimum of 3 distinct files to create: To do so, we will use a Test Driven Development (TDD) approach, relying on writing some test cases first, followed by the implementation a solution. In this section we will write a custom rule from scratch. Let's start by building the custom-plugin template by using the following command: In this tutorial, we will only use the file named pom_SQ_8_9_LTS.xml, as it is completely independent from the build of the Java Analyzer, is self-contained, and will target the latest release of SonarQube. These 3 poms correspond different use-cases, depending on which instance of SonarQube you will target with your custom-rules plugin.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |