@@ -42,10 +42,18 @@ But it can be useful to prepare a test project to check the correct execution of
4242
43431 . Clone the Git repository
44442 . Run ` yarn install ` inside ** eslint-plugin** directory
45- 3 . You are good to go! 🚀
45+ 3 . Synchronize dependencies using Maven inside ** sonar-plugin** directory
46+ 4 . You are good to go! 🚀
4647
4748## Create a rule
4849
50+ ### Before starting
51+
52+ Before even starting to implement the rule, it must have been discussed, mesured and documented in the ecoCode
53+ referential. Please follow
54+ the [ dedicated documentation] ( https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/README.md )
55+ to find out how to proceed.
56+
4957### In the ESLint plugin
5058
5159The file structure inside ** eslint-plugin** package provides an ESLint-compliant project.\
@@ -66,16 +74,13 @@ The project itself uses ESLint to helps linting rule algorithms.
6674
6775### In the SonarQube plugin
6876
69- The SonarQube plugin does not contain the implementation of rules, only declarations and documentations.
70-
71- Example set of files to add a rule called ** "my-awesome-rule"** (SonarQube key: ** EC1** ):
77+ Now that the rule has been implemented in the ecoCode referential and its implementation written in the ESLint plugin,
78+ all that remains is to reference it in the SonarQube plugin. Here are the simple steps:
7279
73- - ` src/main/java/io/ecocode/javascript/checks/MyAwesomeRule.java ` : declaration file with the SonarQube key and the
74- ESLint key
75- - ` src/main/resources/rules/javascript/EC1.json ` : detail of the rule for SonarQube
76- - ` src/main/resources/rules/javascript/EC1.html ` : documentation of the rule for SonarQube
77-
78- You will also need to edit custom profile JSON file and ` CheckList.java ` to add your rule name in appropriate lists.
80+ 1 . Create a Java class in ` src/main/java/io/ecocode/javascript/checks/ ` with the declaration of the SonarQube key and
81+ the ESLint key (check other classes to have an example)
82+ 2 . Reference created in method ` getAllChecks() ` of Java class ` CheckList ` (please use alphabetical order)
83+ 3 . Add the SonarQube key of the rule in the appropriate profile Json file.
7984
8085### Test the rule
8186
@@ -89,6 +94,8 @@ This will allow a large code coverage and avoid false positives.
8994Run the following script to start all test suites: ` yarn run test ` .\
9095To display tests coverage, use ` yarn run test:cov ` .
9196
97+ > ℹ You don't need to add a test in the Sonar plugin, the class will be tested automatically.
98+
9299### Generate rule documentation
93100
94101A tool called [ eslint-doc-generator] ( https://github.com/bmish/eslint-doc-generator ) is used in the project to update
0 commit comments