-
Notifications
You must be signed in to change notification settings - Fork 455
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
Allow for using a PatternFilterable
to determine source processed by JavaExtension
and KotlinExtension
#153
Comments
It's possible to do this already with If you can make the documentation easy for users, and the implementation doesn't add a large maintenance burden, I'd be happy to merge. |
Do you mean by using javadocs or by updating the information in the README? I use plugin Javadocs a lot but that's because I use Gradle Kotlin DSL so I get actual plugin source code I can navigate to. Do you think that target should take precedence and override any configured Also, would it make sense to filter by source set or would that overcomplicate the issue? |
Both, but especially the README. "Spotless will format every file in target, and if you don't set it then the default value is X" is the contract right now.
I dunno. What's nice about just having For my projects, generated code is always in its own sourceset, and I set the target explicitly, e.g. java {
target 'src/main/java/**/*.java', 'src/test/java/**/*.java'
// this avoids src/main/generated-jooq and src/main/generated-rocker
} The questions you are asking are the right ones. My conclusion is "target is easy and good enough", but I've put very little effort into it. If you find a better solution, I'm all for it! Just make sure you've figured out what the behavior ought to be, and how you'd like to communicate it to users, before you spend time building it. |
The problem with what I've got is that my company has our generated jooq code in the Currently the build is in maven but I'm thinking about attempting a second rewrite in gradle (the first attempt (which was successful!!) died on a feature branch that got killed 😢) |
How long ago did it get killed? You should still be able to grab it from the reflog. (little video of my fav free reflog tool) |
It's not time. It's just that most of it lives on a git branch that has deviated so far from master that it's going to be difficult to redo. I still have the branch checked out in a separate clone of the repo on my work machine. I had to move a lot of code around to get it to work, ended up deleting some irrelevant projects for that the feature was making irrelevant, ect. That feature (actually more of a full project) got killed so the old code was still relevant. I can port much of the same gradle logic, but I need to do the refactor and move code around dance all over again. |
I've proposed a fix in #353. |
Fixed in 3.18.0. |
Sometimes you want your entire source code to be linted/formatted except for some code in a particular package.
For example, in my project I want everything reformatted except for things in files that match the pattern
**/generated/**
.When setting up my java source sets, if I didn't want these files to be compiled I could do something like this:
I propose that spotless should expose the same API for filtering out sources that I don't want to be linted or reformatted.
I would expose an API that allowed the user to use a
PatternFilterable
to configure what is excluded from the task'starget
FileCollection
.The text was updated successfully, but these errors were encountered: