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

adding gradle and groovy auto detection #4561

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

lkerford
Copy link
Contributor

@lkerford lkerford commented Oct 8, 2024

Updating the autodetect class to pick up styles from the gradle files

Previously no style would be detected for groovy files, this is because we weren't parsing the block element within lambdas in method declarations

Adding autodetect for groovy and gradle, adding 2 seperact auto detection classes to allow for repositories to have different styles for gradle build files and groovy tests.

These auto detection classes utilize the java auto detection
lkerford and others added 3 commits October 8, 2024 15:00
…detectTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…detectTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
);
var detector = Autodetect.detector();
parse.forEach(detector::sample);
var styles = detector.build();
Copy link
Member

@sambsnyd sambsnyd Oct 8, 2024

Choose a reason for hiding this comment

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

Is the type of styles org.openrewrite.java.style.Autodetect or org.openrewrite.gradle.style.Autodetect ? 🙂

Might influence whether your other PRs work as intended or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are 100% correct, I have pushed an update which will fix this issue

@lkerford lkerford requested a review from sambsnyd October 8, 2024 23:22
@lkerford lkerford merged commit 7522567 into main Oct 8, 2024
2 checks passed
@lkerford lkerford deleted the adding-groovy-gradle-auto-detection branch October 8, 2024 23:42
@@ -65,8 +65,7 @@ public static class Detector {
private final FindLineFormatJavaVisitor findLineFormat = new FindLineFormatJavaVisitor();

public void sample(SourceFile cu) {
// only sample Java sources (extending languages need their own auto-detection)
if (cu instanceof J.CompilationUnit) {
if (cu instanceof JavaSourceFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@sambsnyd It seems to me that we shouldn't have to change this now. What am I missing?

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

Successfully merging this pull request may close these issues.

3 participants