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

Add SortYaml recipe to streamline yaml files (gitlab ci, spring boot properties...) #5002

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Jenson3210
Copy link
Contributor

What's changed?

Allowing yaml files to be sorted according to a list of input. Could help in creating a gitlab-ci.yaml order.

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

Took some assumptions on the input variables -> please validate if this would be workable. Should we go for JsonPath instead? That would require us to support way more notations even.

Have you considered any alternatives or workarounds?

Not really, like mentioned I considered JsonPath but that's perhaps too elaborate. Maybe use jsonpath notations (with $) and in validation validate it's only going to be one of the 3 supported notations

Any additional context

The recipe supports several features in this version:

  • fixed property/path
  • Wildcards that match single property (*)
  • Wildcards that match multiple properties (**)
  • Property pickers ([]) to sort on their value instead of the mentioned property key

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-hcl/src/main/java/org/openrewrite/hcl/format/TabsAndIndentsVisitor.java
    • lines 255-256
  • rewrite-hcl/src/main/java/org/openrewrite/hcl/internal/HclPrinter.java
    • lines 363-364
  • rewrite-java/src/main/java/org/openrewrite/java/internal/template/AnnotationTemplateGenerator.java
    • lines 158-159
  • rewrite-java/src/main/java/org/openrewrite/java/internal/template/BlockStatementTemplateGenerator.java
    • lines 281-282
    • lines 669-669
  • rewrite-java/src/main/java/org/openrewrite/java/search/FindEmptyClasses.java
    • lines 57-57
  • rewrite-xml/src/main/java/org/openrewrite/xml/internal/XmlPrinter.java
    • lines 106-106
  • rewrite-yaml/src/main/java/org/openrewrite/yaml/cleanup/RemoveUnusedVisitor.java
    • lines 76-76

@timtebeek timtebeek added the enhancement New feature or request label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants