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

@PackageRecipeTags annotation on package-info.java #3954

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JLLeitschuh
Copy link
Collaborator

Adds a package level annotation for adding tags to recipes at the
package-level scope.

Signed-off-by: Jonathan Leitschuh Jonathan.Leitschuh@gmail.com

What's changed?

Recipe#getDescriptor now looks for Recipe tags on package-info.java, as well as parent package-info.java.

What's your motivation?

When writing recipes that all fall into a similar set of tags, for example security recipes, you likely want to
tag recipes at the package level, so you don't need to add the same exact tag to every single Recipe.

Anything in particular you'd like reviewers to focus on?

Is the PackageRecipeTags annotation name fine?

Anyone you would like to review specifically?

Anyone!

Have you considered any alternatives or workarounds?

Could write an OpenRewrite-OpenRewrite recipe that modifies every recipe in a package to add a tag.

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@JLLeitschuh JLLeitschuh changed the title @PackageRecipeTags annotation on package-info @PackageRecipeTags annotation on package-info.java Jan 29, 2024
Adds a package level annotation for adding tags to recipes at the
package-level scope.

Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
@JLLeitschuh JLLeitschuh force-pushed the feat/JLL/annotation_PackageRecipeTags branch from ffb939f to 275dc68 Compare January 29, 2024 01:37
@jkschneider
Copy link
Member

I like the concept, but rather than adding a package level annotation, I think this concept would better fit in our category resource concept. Categories are tied to packages so putting tags on the category should apply to all recipes in that category. There is a category yml format.

@JLLeitschuh
Copy link
Collaborator Author

Can you elaborate upon what the difference between categories and tags, at a high level, are supposed to be.

I also had a similar realization, once I realized that categories existed. The annoying downside is that those category added tags won't show up when you call getDescriptor().getTags() but I don't think that's a big deal.

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

Successfully merging this pull request may close these issues.

None yet

2 participants