Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ allprojects {
}
apply from: rootProject.file('gradle/spotless-freshmark.gradle')

spotless {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lets avoid the redundancy if possible and follow:

  • separation of control instead of
  • duplication of control

groovyGradle {
target '*.gradle', 'gradle/*.gradle'
}
format 'dotfiles', {
target '.gitignore', '.gitattributes', '.editorconfig'
leadingTabsToSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
}

dependencies {
rewrite(platform('org.openrewrite.recipe:rewrite-recipe-bom:3.18.0'))
Expand Down
8 changes: 7 additions & 1 deletion gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ spotless {
}
}
groovyGradle {
target '*.gradle'
target '*.gradle', 'gradle/*.gradle'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we really need both ?

Copy link
Member

@jbduncan jbduncan Nov 19, 2025

Choose a reason for hiding this comment

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

Yeah, I believe so, because:

  • *.gradle means "search for all files ending with .gradle in the project directory"
  • gradle/*.gradle means "search for all files ending with .gradle in the gradle subdirectory"

The alternative, **/*.gradle, which IIRC means "search for all files ending with .gradle in the project directory and every sub-directory", is slower than necessary because it searches through more things.

Copy link
Contributor Author

@Pankraz76 Pankraz76 Nov 19, 2025

Choose a reason for hiding this comment

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

The alternative, **/*.gradle, which IIRC means "search for all files ending with .gradle in the project directory and every sub-directory", is slower than necessary because it searches through more things.

Thank you yes, was thinking about double as well, good layout.

slower than necessary

imho, code (simplicity, accessibility) over cpu.

Suggested change
target '*.gradle', 'gradle/*.gradle'
target '**.gradle'

Copy link
Member

Choose a reason for hiding this comment

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

Can you post here how long it takes to run Spotless before and after the change? If there's no noticeable difference and Ned is happy with it, then I'll accept it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will try.

IMO, Ned is pretty straightforward, having a good “doesn’t matter” mentality. Especially when it comes to chasing seconds around. IMO, it won’t take much longer, but I’m interested too, lets see.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed that we do need both. And it's surprising how bad the performance of target '**/*.gradle' is. We used to have it, I think the problem is that it gobbles the .git folder too sometimes. Anyway, PR looked good as-is, merged.

greclipse().configFile rootProject.files('gradle/spotless.eclipseformat.xml', 'gradle/spotless.groovyformat.prefs')
}
format 'dotfiles', {
target '.gitignore', '.gitattributes', '.editorconfig'
leadingTabsToSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
}
Loading