Skip to content

Commit

Permalink
Update 0002-recipe-naming.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider authored Apr 23, 2021
1 parent 738b7f2 commit cd71b83
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/adr/0002-recipe-naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public class DeleteKey extends Recipe {
}
```

### Recipe package naming

Recipes are currently organized hierarchically by package name. These package naming guidelines apply to both recipes defined in code as well as the name given to declarative recipes defined in YAML.

* **DO** start every OpenRewrite recipe package with with `org.openrewrite.<LANGUAGE>`.
* **DO** place every general-purpose search recipe in `org.openrewrite.<LANGUAGE>.search`.
* **DO** place every general-purpose security recipe in `org.openrewrite.<LANGUAGE>.security`.
* **DO** place every general-purpose formatting recipe in `org.openrewrite.<LANGUAGE>.format`.
* **DO** place every general-purpose cleanup recipe in `org.openrewrite.<LANGUAGE>.cleanup`. Note that in IDEs, "Code cleanup" is typically a separate action from "Format code", which is why the two hygiene-related tasks of formatting and cleanup are in distinct packages.

### Display names

* **DO** provide a short name ideally consisting of less than 5 words, but definitely less than 10 words.
Expand All @@ -49,6 +59,13 @@ public class DeleteKey extends Recipe {
* **DO** use markdown backticks (`) to delimit words representing code symbols.
* **DO NOT** reference alternatives in other static analyzers or products.

### Tagging

Tags are independent of one another. A recipe containing a tag will show up in any categorical listing by that tag.

* **DO** use all lower-case tag names, e.g. "security", "testing".
* **DO NOT** tag with language name.

## Consequences

Various user experiences listing OpenRewrite recipes are able to present a clean view of available recipes by relying strictly on the metadata provided by the recipe.
Expand Down

0 comments on commit cd71b83

Please sign in to comment.