Skip to content

Commit 103fa20

Browse files
committed
Update CONTRIBUTING.md
1 parent 0f1262e commit 103fa20

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- [#30](https://github.com/green-code-initiative/ecoCode-javascript/issues/30) Fix typo in EC12 rule
13+
1014
## [1.4.0] - 2023-10-30
1115

1216
### Added

CONTRIBUTING.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ But it can be useful to prepare a test project to check the correct execution of
4242

4343
1. Clone the Git repository
4444
2. 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

5159
The 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.
8994
Run the following script to start all test suites: `yarn run test`.\
9095
To 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

94101
A tool called [eslint-doc-generator](https://github.com/bmish/eslint-doc-generator) is used in the project to update

0 commit comments

Comments
 (0)