+1 to anything we can do to automate this. I love having autoformat every time I save in an IDE though I haven't set that up for Beam.
FWIW spotlessApply is fast enough that even autoformatting the whole codebase is pretty much negligible time (and dominated by gradle reading configs). I never bother targetting it to a particular module I am working on, even. Kenn On Mon, Dec 2, 2024 at 8:15 AM Danny McCormick via dev <dev@beam.apache.org> wrote: > +1, I think this is a good idea. The only downside I can think of is a > little bit of extra time per local build, but it seems like a worthwhile > tradeoff. 2 additional suggestions: > - we could consider doing this across languages as well (e.g. running the > python lint and format precommits as part of compile). Go already does this > automatically IIRC > - we could introduce a flag for skipping these checks for faster > compile/dev loop time. The difference here would be opting out of a > spotless check instead of opting into it. > > Thanks, > Danny > > On Mon, Dec 2, 2024 at 3:27 AM Jan Lukavský <je...@seznam.cz> wrote: > >> Hi, >> >> there is interesting thread in Maven dev list [1], which discusses >> automatic spotlessApply as part of build. I personally use exactly same >> approach on other projects - i.e. compileJava depends on spotlessApply. >> The benefit is that CI rarely fails due to spotless (the only >> possibility is a commit that was not even compiled) and I didn't come >> across any significant drawbacks. The question therefore is, should we >> automatically apply spotless as part of (local) build or do we have any >> reasons why not to? CI builds should use just spotlessCheck, because >> local changes will not be committed nevertheless. >> >> Jan >> >> >> [1] https://lists.apache.org/thread/9703k96md8lnlwnd0cz1qmqqkrkldtty >> >>