Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Challenge 2024] Documentation improvement #50

Open
ValentinLeTallec opened this issue May 30, 2024 · 1 comment
Open

[Challenge 2024] Documentation improvement #50

ValentinLeTallec opened this issue May 30, 2024 · 1 comment

Comments

@ValentinLeTallec
Copy link

ValentinLeTallec commented May 30, 2024

As a developer on ecoCode I would like to be informed in the documentation :

  • Of why @DeprecatedRuleKey is often present on rule implementation : it is for old rules to be linked to their old keys and is not necessary for new rules.
  • Of the steps to add a rule in ecocode-rules-specifications
    • mvn clean install
    • Update the pom.xml of the language plugin with the SNAPSHOT version.
@ValentinLeTallec
Copy link
Author

ValentinLeTallec commented May 30, 2024

Proposition by JY:

You will need to clone 3 repos :

  • https://github.com/green-code-initiative/ecoCode.git
    • For a rule that already exists (existing ID) but is not described for the target language:
      • create a subfolder with the language name
      • create an ASCIIDOC file in it with the rule description for the chosen language, along with an example of KO code and an example of OK code.
      • For an example, you can refer to the rule EC31 for java: : ecoCode/ecocode-rules-specifications/src/main/rules/EC31/java/EC31.asciidoc
      • For a rule that doesn't yet exist, determine an ID (random number between 1000 and 1500) that doesn't yet exist and add a JSON metadata file to describe the rule, its remediation cost, its tags, etc. (take the example of other rules) and add the sub-tree structure from the previous point.
    • do an mvn install of this project to have the dependency in your local maven cache
  • ecocode-<lang> : to implement the rule for a target language
    • in the implementation, don't forget to add the @rule(key = “ECxx”) annotation for Java, PHP, Python (for other languages like HTML, JS, etc ... I don't know)
    • modify this project's pom.xml (but don't commit it) to target the previous module packaged in the local maven cache
    • create an mvn package to produce the version of the plugin embedding the implementation and specification of the rule concerned
      • exemple for ecocode-java/pom.xml : <ecocode-rules-specifications.version>1.5.5-SNAPSHOT</ecocode-rules-specifications.version>
      • It's ready to be tested in your local instance of SonarQube !
  • ecoCode-<lang>-test-project : to add a real-life example of an outcome that a sonar analysis should detect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant