You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Carter Kozak <ck...@ckozak.net> on 2022/01/13 03:23:07 UTC

Code Formatter?

Hi all,

We've discussed the idea of using a code formatter before, I finally had a moment put up an example. Please take a look and provide feedback at your convenience :-)
https://github.com/apache/logging-log4j2/pull/697

-ck

Re: Code Formatter?

Posted by Matt Sicker <bo...@gmail.com>.
I'd love for a formatter to be added. I'm not sure how we could best
approach reformatting (all at once or incrementally). What I've liked
in the Spinnaker project is that we use spotless and a git pre-commit
hook to help ensure everyone's code gets formatted appropriately
before being committed.

On Thu, Jan 13, 2022 at 3:57 AM Xeno Amess <xe...@gmail.com> wrote:
>
> and it uses eclipse formatter to file, so I do think you can export&import
> Eclipse config file
>
> Xeno Amess <xe...@gmail.com> 于2022年1月13日周四 17:54写道:
>
> > try this:
> >
> > net.revelc.code.formatter:formatter-maven-plugin:2.17.1
> >
> > It worked well in my team for 2 years, never cause any trouble.
> >
> > Gary Gregory <ga...@gmail.com> 于2022年1月13日周四 17:36写道:
> >
> >> I am ok with formatting code but I want to do it in Eclipse. I did not
> >> even
> >> notice the POM was changed. I would think it better (for me at least) if
> >> an
> >> Eclipse config file was provided I can just import, then when I format the
> >> code for a method/class/package, the same formatting applies (as whatever
> >> created this PR) while respecting the formatter's off/on directives.
> >> Gary
> >>
> >> On Thu, Jan 13, 2022, 03:58 Jochen Wiedmann <jo...@gmail.com>
> >> wrote:
> >>
> >> > On Thu, Jan 13, 2022 at 4:23 AM Carter Kozak <ck...@ckozak.net> wrote:
> >> >
> >> > > We've discussed the idea of using a code formatter before, I finally
> >> had
> >> > a moment put up an example. Please take a look and provide feedback at
> >> your
> >> > convenience :-)
> >> > > https://github.com/apache/logging-log4j2/pull/697
> >> >
> >> > The main problem, that I see with that: Your PR should (IMO) provide
> >> > only the changes in the POM, or whatever else is required to introduce
> >> > the code formatter, so as to enable the changes in the actual code as
> >> > a second step.
> >> >
> >> > Jochen
> >> >
> >> >
> >> > --
> >> > Philosophy is useless, theology is worse. (Industrial Desease, Dire
> >> > Straits)
> >> >
> >>
> >

Re: Code Formatter?

Posted by Xeno Amess <xe...@gmail.com>.
and it uses eclipse formatter to file, so I do think you can export&import
Eclipse config file

Xeno Amess <xe...@gmail.com> 于2022年1月13日周四 17:54写道:

> try this:
>
> net.revelc.code.formatter:formatter-maven-plugin:2.17.1
>
> It worked well in my team for 2 years, never cause any trouble.
>
> Gary Gregory <ga...@gmail.com> 于2022年1月13日周四 17:36写道:
>
>> I am ok with formatting code but I want to do it in Eclipse. I did not
>> even
>> notice the POM was changed. I would think it better (for me at least) if
>> an
>> Eclipse config file was provided I can just import, then when I format the
>> code for a method/class/package, the same formatting applies (as whatever
>> created this PR) while respecting the formatter's off/on directives.
>> Gary
>>
>> On Thu, Jan 13, 2022, 03:58 Jochen Wiedmann <jo...@gmail.com>
>> wrote:
>>
>> > On Thu, Jan 13, 2022 at 4:23 AM Carter Kozak <ck...@ckozak.net> wrote:
>> >
>> > > We've discussed the idea of using a code formatter before, I finally
>> had
>> > a moment put up an example. Please take a look and provide feedback at
>> your
>> > convenience :-)
>> > > https://github.com/apache/logging-log4j2/pull/697
>> >
>> > The main problem, that I see with that: Your PR should (IMO) provide
>> > only the changes in the POM, or whatever else is required to introduce
>> > the code formatter, so as to enable the changes in the actual code as
>> > a second step.
>> >
>> > Jochen
>> >
>> >
>> > --
>> > Philosophy is useless, theology is worse. (Industrial Desease, Dire
>> > Straits)
>> >
>>
>

Re: Code Formatter?

Posted by Xeno Amess <xe...@gmail.com>.
try this:

net.revelc.code.formatter:formatter-maven-plugin:2.17.1

It worked well in my team for 2 years, never cause any trouble.

Gary Gregory <ga...@gmail.com> 于2022年1月13日周四 17:36写道:

> I am ok with formatting code but I want to do it in Eclipse. I did not even
> notice the POM was changed. I would think it better (for me at least) if an
> Eclipse config file was provided I can just import, then when I format the
> code for a method/class/package, the same formatting applies (as whatever
> created this PR) while respecting the formatter's off/on directives.
> Gary
>
> On Thu, Jan 13, 2022, 03:58 Jochen Wiedmann <jo...@gmail.com>
> wrote:
>
> > On Thu, Jan 13, 2022 at 4:23 AM Carter Kozak <ck...@ckozak.net> wrote:
> >
> > > We've discussed the idea of using a code formatter before, I finally
> had
> > a moment put up an example. Please take a look and provide feedback at
> your
> > convenience :-)
> > > https://github.com/apache/logging-log4j2/pull/697
> >
> > The main problem, that I see with that: Your PR should (IMO) provide
> > only the changes in the POM, or whatever else is required to introduce
> > the code formatter, so as to enable the changes in the actual code as
> > a second step.
> >
> > Jochen
> >
> >
> > --
> > Philosophy is useless, theology is worse. (Industrial Desease, Dire
> > Straits)
> >
>

Re: Code Formatter?

Posted by Gary Gregory <ga...@gmail.com>.
I am ok with formatting code but I want to do it in Eclipse. I did not even
notice the POM was changed. I would think it better (for me at least) if an
Eclipse config file was provided I can just import, then when I format the
code for a method/class/package, the same formatting applies (as whatever
created this PR) while respecting the formatter's off/on directives.
Gary

On Thu, Jan 13, 2022, 03:58 Jochen Wiedmann <jo...@gmail.com>
wrote:

> On Thu, Jan 13, 2022 at 4:23 AM Carter Kozak <ck...@ckozak.net> wrote:
>
> > We've discussed the idea of using a code formatter before, I finally had
> a moment put up an example. Please take a look and provide feedback at your
> convenience :-)
> > https://github.com/apache/logging-log4j2/pull/697
>
> The main problem, that I see with that: Your PR should (IMO) provide
> only the changes in the POM, or whatever else is required to introduce
> the code formatter, so as to enable the changes in the actual code as
> a second step.
>
> Jochen
>
>
> --
> Philosophy is useless, theology is worse. (Industrial Desease, Dire
> Straits)
>

Re: Code Formatter?

Posted by Jochen Wiedmann <jo...@gmail.com>.
On Thu, Jan 13, 2022 at 4:23 AM Carter Kozak <ck...@ckozak.net> wrote:

> We've discussed the idea of using a code formatter before, I finally had a moment put up an example. Please take a look and provide feedback at your convenience :-)
> https://github.com/apache/logging-log4j2/pull/697

The main problem, that I see with that: Your PR should (IMO) provide
only the changes in the POM, or whatever else is required to introduce
the code formatter, so as to enable the changes in the actual code as
a second step.

Jochen


--
Philosophy is useless, theology is worse. (Industrial Desease, Dire Straits)