diff --git a/README.adoc b/README.adoc index f791a6f613..8b3d10e0f0 100644 --- a/README.adoc +++ b/README.adoc @@ -90,28 +90,35 @@ Otherwise, you can use https://asciidoclive.com/[AsciiDocLIVE] and this https:// ==== To add language to an existing rule -If the rule exists on the main branch, create a PR named "Create rule Sxxxx[_language_]: _rule title_". For example: +Similar to adding a new rule, if the rule exists on the main branch, trigger the "Add language to a rule" GitHub action. + +. go to the https://github.com/SonarSource/rspec/actions/workflows/add_language.yml[Add language to a rule] GitHub action +. click on the grey _Run wokflow_ button (on the right). +. in the field _"ID of an existing rule"_ write the ID of the existing rule you want to add language to. +It must be in a form `Sxxxx` where `xxxx` is the number of the rule. +For example, `S100`, `S1234`, `S6000`. +. write the list of languages you want to specify this rule for. +. in the field _"Language to be added to the rule"_ specify one language to be added to the rule. + +It can be any of the following: +include::supported_languages.adoc[] +. click on the green _Run workflow_ button. + +image::img/add-language-workflow.png[] + +You should see https://github.com/pulls/assigned[a new pull request assigned to you]. +It might take up to a few minutes to appear. +It contains a scaffolding of files for the new rule. Feel free to modify it as you please. + +The title of the PR for a new rule will say only "Create rule Sxxxx[lang]", which is not very informative. + +Modify the title to better summarize the nature or the rule, so that it is easier to find when searching through unimplemented rules. +Do preserve the "Create rule Sxxxx[lang]" prefix, as it is used by our tooling. +For example: ---- Create rule S100[java]: Method names should comply with a naming convention ---- Otherwise, if the rule has not been merged yet (i.e. the rule has not been implemented by any plugin), you can use the already existing PR corresponding to this rule. + -Then add a corresponding github label to the PR. - -In order to automatically trigger a preview of the rule specialization in the deployment, your branch name must start with `rule/`. - -Then, - -* Create a subdirectory with the name of the language you want to add. + -It can be any of the following: -include::supported_languages.adoc[] -* Add two files in this subdirectory: - -** `rule.adoc`: write down the whole description of the rule. If you want to include already existing parts (that are in the current or the parent directory), use the `include::` syntax. -** `metadata.json`: it automatically inherits from the `metadata.json` of the parent directory so you only need to write the parts that need to be overwritten. + -Please note that in any case this file should at least contain two curly braces (`{ }`) - ==== To modify an existing rule Create a branch for your modifications manually. Then open a pull request manually. diff --git a/img/add-language-workflow.png b/img/add-language-workflow.png new file mode 100644 index 0000000000..6a5efb582d Binary files /dev/null and b/img/add-language-workflow.png differ