Skip to content

Commit

Permalink
Added spotless rule to refuse wildcard imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasSchaub committed Nov 2, 2023
1 parent b4b2e91 commit 9e9876d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ spotless {
//palantirJavaFormat() //not optimal, because unnecessary line breaks in head of for loop and corrupts editor folds
//prettier() //needs npm installed, unsuitable...
//clangFormat() //also needs an installation...
custom 'Refuse wildcard imports', {
// Wildcard imports can't be resolved by spotless itself.
// This will require the developer themselves to adhere to best practices.
if (it =~ /\nimport .*\*;/) {
throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.")
}
}
}
}

Expand Down

0 comments on commit 9e9876d

Please sign in to comment.