You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Slawomir Jaranowski <s....@gmail.com> on 2021/10/18 05:10:35 UTC

Re: Maven Code Style and imports layouts

Hi,

In order to help make decisions, I prepared PR [1] with the most used order
layout in Maven Core.

Please look and vote / approve / choose another proposition.

[1] https://github.com/apache/maven-site/pull/269


czw., 23 wrz 2021 o 23:47 Slawomir Jaranowski <s....@gmail.com>
napisał(a):

> Hi
>
> I checked the maven core project to see how many files don't meet the
> proposed layout.
>
> All imports in each group are alphabetically sorted.
>
>
> 1,
> - import javax.*
> - import java.*
> - blank line
> - all other imports
> - blank line
> - import static all other imports
>
> -> 285 files to change
>
> 2.
> - static imports
> - blank line
> - all other imports alphabetically
>
> -> 673 files to change
>
> 3.
> - import javax.*
> - blank line
> - import java.*
> - blank line
> - all other imports
> - blank line
> - import static all other imports
>
> -> 196 files to change
>
> 3.
> - import static all other imports
> - blank line
> - import javax.*
> - blank line
> - import java.*
> - blank line
> - all other imports
>
> -> 302 files to change
>
>
> So option 3 seems the most popular in maven , but it is easy to change for
> all files, or only looks in changed files.
> In the first step, preparing documentation is most important - may be
> enough.
>
> I've created issue for it [1]
>
> Please vote for a proposition or give another one.
>
>
> [1] https://issues.apache.org/jira/browse/MNGSITE-465
>
>
>
> sob., 18 wrz 2021 o 20:38 Elliotte Rusty Harold <el...@ibiblio.org>
> napisał(a):
>
>> simpler is better, though perhaps the fundamental rule should be don't
>> reporter what's already there. That is, avoid needless churn.
>>
>> My preferred style is:
>>
>> static imports
>> blank line
>> all other imports alphabetically
>>
>>
>> On Fri, Sep 17, 2021 at 9:19 PM Slawomir Jaranowski
>> <s....@gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > We have described many rules about code style on Maven Code Style And
>> Code
>> > Conventions [1].
>> >
>> > One item missing for me is how java imports should be ordered and
>> groped.
>> > I can setup it in IDE and it is very useful to use code formatting with
>> > tools.
>> > I think that all propositions in this case will be ok - the most
>> important
>> > is to have one standard.
>> > At the end we can even use checkstyle to verify it ... [2]
>> >
>> > So first proposition:
>> >
>> > - import javax.*
>> > - import java.*
>> >
>> > - blank line
>> >
>> > - all other imports
>> >
>> > - blank line
>> >
>> > - import static all other imports
>> >
>> >
>> > [1] https://maven.apache.org/developers/conventions/code.html
>> > [2] https://checkstyle.sourceforge.io/config_imports.html#ImportOrder
>> >
>> > --
>> > Sławomir Jaranowski
>> >
>> > https://twitter.com/SlawekJaran
>> > https://github.com/slawekjaranowski
>> > https://linkedin.com/in/slawomirjaranowski
>>
>>
>>
>> --
>> Elliotte Rusty Harold
>> elharo@ibiblio.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
> --
> Sławomir Jaranowski
>


-- 
Sławomir Jaranowski

Re: Maven Code Style and imports layouts

Posted by Slawomir Jaranowski <s....@gmail.com>.
Hi,

Benjamin - thanks for voting.

Can we finish this task?
I assume that there are no -1 votes so it should be processed ...

Any other suggestions, improvements?

pon., 18 paź 2021 o 08:28 Benjamin Marwell <bm...@apache.org> napisał(a):

> +1!
>
>  Sandra and I tried similar Suggestions a while back.
> This will help new contributors a lot.
>
> Thanks for your efforts!
>
> On Mon, 18 Oct 2021, 07:10 Slawomir Jaranowski, <s....@gmail.com>
> wrote:
>
> > Hi,
> >
> > In order to help make decisions, I prepared PR [1] with the most used
> order
> > layout in Maven Core.
> >
> > Please look and vote / approve / choose another proposition.
> >
> > [1] https://github.com/apache/maven-site/pull/269
> >
> >
> > czw., 23 wrz 2021 o 23:47 Slawomir Jaranowski <s....@gmail.com>
> > napisał(a):
> >
> > > Hi
> > >
> > > I checked the maven core project to see how many files don't meet the
> > > proposed layout.
> > >
> > > All imports in each group are alphabetically sorted.
> > >
> > >
> > > 1,
> > > - import javax.*
> > > - import java.*
> > > - blank line
> > > - all other imports
> > > - blank line
> > > - import static all other imports
> > >
> > > -> 285 files to change
> > >
> > > 2.
> > > - static imports
> > > - blank line
> > > - all other imports alphabetically
> > >
> > > -> 673 files to change
> > >
> > > 3.
> > > - import javax.*
> > > - blank line
> > > - import java.*
> > > - blank line
> > > - all other imports
> > > - blank line
> > > - import static all other imports
> > >
> > > -> 196 files to change
> > >
> > > 3.
> > > - import static all other imports
> > > - blank line
> > > - import javax.*
> > > - blank line
> > > - import java.*
> > > - blank line
> > > - all other imports
> > >
> > > -> 302 files to change
> > >
> > >
> > > So option 3 seems the most popular in maven , but it is easy to change
> > for
> > > all files, or only looks in changed files.
> > > In the first step, preparing documentation is most important - may be
> > > enough.
> > >
> > > I've created issue for it [1]
> > >
> > > Please vote for a proposition or give another one.
> > >
> > >
> > > [1] https://issues.apache.org/jira/browse/MNGSITE-465
> > >
> > >
> > >
> > > sob., 18 wrz 2021 o 20:38 Elliotte Rusty Harold <el...@ibiblio.org>
> > > napisał(a):
> > >
> > >> simpler is better, though perhaps the fundamental rule should be don't
> > >> reporter what's already there. That is, avoid needless churn.
> > >>
> > >> My preferred style is:
> > >>
> > >> static imports
> > >> blank line
> > >> all other imports alphabetically
> > >>
> > >>
> > >> On Fri, Sep 17, 2021 at 9:19 PM Slawomir Jaranowski
> > >> <s....@gmail.com> wrote:
> > >> >
> > >> > Hi,
> > >> >
> > >> > We have described many rules about code style on Maven Code Style
> And
> > >> Code
> > >> > Conventions [1].
> > >> >
> > >> > One item missing for me is how java imports should be ordered and
> > >> groped.
> > >> > I can setup it in IDE and it is very useful to use code formatting
> > with
> > >> > tools.
> > >> > I think that all propositions in this case will be ok - the most
> > >> important
> > >> > is to have one standard.
> > >> > At the end we can even use checkstyle to verify it ... [2]
> > >> >
> > >> > So first proposition:
> > >> >
> > >> > - import javax.*
> > >> > - import java.*
> > >> >
> > >> > - blank line
> > >> >
> > >> > - all other imports
> > >> >
> > >> > - blank line
> > >> >
> > >> > - import static all other imports
> > >> >
> > >> >
> > >> > [1] https://maven.apache.org/developers/conventions/code.html
> > >> > [2]
> https://checkstyle.sourceforge.io/config_imports.html#ImportOrder
> > >> >
> > >> > --
> > >> > Sławomir Jaranowski
> > >> >
> > >> > https://twitter.com/SlawekJaran
> > >> > https://github.com/slawekjaranowski
> > >> > https://linkedin.com/in/slawomirjaranowski
> > >>
> > >>
> > >>
> > >> --
> > >> Elliotte Rusty Harold
> > >> elharo@ibiblio.org
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail: dev-help@maven.apache.org
> > >>
> > >>
> > >
> > > --
> > > Sławomir Jaranowski
> > >
> >
> >
> > --
> > Sławomir Jaranowski
> >
>


-- 
Sławomir Jaranowski

Re: Maven Code Style and imports layouts

Posted by Xeno Amess <xe...@gmail.com>.
...if there be a style restriction, adding it to CI is necessary.

Benjamin Marwell <bm...@apache.org> 于2021年10月18日周一 下午2:28写道:

> +1!
>
>  Sandra and I tried similar Suggestions a while back.
> This will help new contributors a lot.
>
> Thanks for your efforts!
>
> On Mon, 18 Oct 2021, 07:10 Slawomir Jaranowski, <s....@gmail.com>
> wrote:
>
> > Hi,
> >
> > In order to help make decisions, I prepared PR [1] with the most used
> order
> > layout in Maven Core.
> >
> > Please look and vote / approve / choose another proposition.
> >
> > [1] https://github.com/apache/maven-site/pull/269
> >
> >
> > czw., 23 wrz 2021 o 23:47 Slawomir Jaranowski <s....@gmail.com>
> > napisał(a):
> >
> > > Hi
> > >
> > > I checked the maven core project to see how many files don't meet the
> > > proposed layout.
> > >
> > > All imports in each group are alphabetically sorted.
> > >
> > >
> > > 1,
> > > - import javax.*
> > > - import java.*
> > > - blank line
> > > - all other imports
> > > - blank line
> > > - import static all other imports
> > >
> > > -> 285 files to change
> > >
> > > 2.
> > > - static imports
> > > - blank line
> > > - all other imports alphabetically
> > >
> > > -> 673 files to change
> > >
> > > 3.
> > > - import javax.*
> > > - blank line
> > > - import java.*
> > > - blank line
> > > - all other imports
> > > - blank line
> > > - import static all other imports
> > >
> > > -> 196 files to change
> > >
> > > 3.
> > > - import static all other imports
> > > - blank line
> > > - import javax.*
> > > - blank line
> > > - import java.*
> > > - blank line
> > > - all other imports
> > >
> > > -> 302 files to change
> > >
> > >
> > > So option 3 seems the most popular in maven , but it is easy to change
> > for
> > > all files, or only looks in changed files.
> > > In the first step, preparing documentation is most important - may be
> > > enough.
> > >
> > > I've created issue for it [1]
> > >
> > > Please vote for a proposition or give another one.
> > >
> > >
> > > [1] https://issues.apache.org/jira/browse/MNGSITE-465
> > >
> > >
> > >
> > > sob., 18 wrz 2021 o 20:38 Elliotte Rusty Harold <el...@ibiblio.org>
> > > napisał(a):
> > >
> > >> simpler is better, though perhaps the fundamental rule should be don't
> > >> reporter what's already there. That is, avoid needless churn.
> > >>
> > >> My preferred style is:
> > >>
> > >> static imports
> > >> blank line
> > >> all other imports alphabetically
> > >>
> > >>
> > >> On Fri, Sep 17, 2021 at 9:19 PM Slawomir Jaranowski
> > >> <s....@gmail.com> wrote:
> > >> >
> > >> > Hi,
> > >> >
> > >> > We have described many rules about code style on Maven Code Style
> And
> > >> Code
> > >> > Conventions [1].
> > >> >
> > >> > One item missing for me is how java imports should be ordered and
> > >> groped.
> > >> > I can setup it in IDE and it is very useful to use code formatting
> > with
> > >> > tools.
> > >> > I think that all propositions in this case will be ok - the most
> > >> important
> > >> > is to have one standard.
> > >> > At the end we can even use checkstyle to verify it ... [2]
> > >> >
> > >> > So first proposition:
> > >> >
> > >> > - import javax.*
> > >> > - import java.*
> > >> >
> > >> > - blank line
> > >> >
> > >> > - all other imports
> > >> >
> > >> > - blank line
> > >> >
> > >> > - import static all other imports
> > >> >
> > >> >
> > >> > [1] https://maven.apache.org/developers/conventions/code.html
> > >> > [2]
> https://checkstyle.sourceforge.io/config_imports.html#ImportOrder
> > >> >
> > >> > --
> > >> > Sławomir Jaranowski
> > >> >
> > >> > https://twitter.com/SlawekJaran
> > >> > https://github.com/slawekjaranowski
> > >> > https://linkedin.com/in/slawomirjaranowski
> > >>
> > >>
> > >>
> > >> --
> > >> Elliotte Rusty Harold
> > >> elharo@ibiblio.org
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail: dev-help@maven.apache.org
> > >>
> > >>
> > >
> > > --
> > > Sławomir Jaranowski
> > >
> >
> >
> > --
> > Sławomir Jaranowski
> >
>

Re: Maven Code Style and imports layouts

Posted by Benjamin Marwell <bm...@apache.org>.
+1!

 Sandra and I tried similar Suggestions a while back.
This will help new contributors a lot.

Thanks for your efforts!

On Mon, 18 Oct 2021, 07:10 Slawomir Jaranowski, <s....@gmail.com>
wrote:

> Hi,
>
> In order to help make decisions, I prepared PR [1] with the most used order
> layout in Maven Core.
>
> Please look and vote / approve / choose another proposition.
>
> [1] https://github.com/apache/maven-site/pull/269
>
>
> czw., 23 wrz 2021 o 23:47 Slawomir Jaranowski <s....@gmail.com>
> napisał(a):
>
> > Hi
> >
> > I checked the maven core project to see how many files don't meet the
> > proposed layout.
> >
> > All imports in each group are alphabetically sorted.
> >
> >
> > 1,
> > - import javax.*
> > - import java.*
> > - blank line
> > - all other imports
> > - blank line
> > - import static all other imports
> >
> > -> 285 files to change
> >
> > 2.
> > - static imports
> > - blank line
> > - all other imports alphabetically
> >
> > -> 673 files to change
> >
> > 3.
> > - import javax.*
> > - blank line
> > - import java.*
> > - blank line
> > - all other imports
> > - blank line
> > - import static all other imports
> >
> > -> 196 files to change
> >
> > 3.
> > - import static all other imports
> > - blank line
> > - import javax.*
> > - blank line
> > - import java.*
> > - blank line
> > - all other imports
> >
> > -> 302 files to change
> >
> >
> > So option 3 seems the most popular in maven , but it is easy to change
> for
> > all files, or only looks in changed files.
> > In the first step, preparing documentation is most important - may be
> > enough.
> >
> > I've created issue for it [1]
> >
> > Please vote for a proposition or give another one.
> >
> >
> > [1] https://issues.apache.org/jira/browse/MNGSITE-465
> >
> >
> >
> > sob., 18 wrz 2021 o 20:38 Elliotte Rusty Harold <el...@ibiblio.org>
> > napisał(a):
> >
> >> simpler is better, though perhaps the fundamental rule should be don't
> >> reporter what's already there. That is, avoid needless churn.
> >>
> >> My preferred style is:
> >>
> >> static imports
> >> blank line
> >> all other imports alphabetically
> >>
> >>
> >> On Fri, Sep 17, 2021 at 9:19 PM Slawomir Jaranowski
> >> <s....@gmail.com> wrote:
> >> >
> >> > Hi,
> >> >
> >> > We have described many rules about code style on Maven Code Style And
> >> Code
> >> > Conventions [1].
> >> >
> >> > One item missing for me is how java imports should be ordered and
> >> groped.
> >> > I can setup it in IDE and it is very useful to use code formatting
> with
> >> > tools.
> >> > I think that all propositions in this case will be ok - the most
> >> important
> >> > is to have one standard.
> >> > At the end we can even use checkstyle to verify it ... [2]
> >> >
> >> > So first proposition:
> >> >
> >> > - import javax.*
> >> > - import java.*
> >> >
> >> > - blank line
> >> >
> >> > - all other imports
> >> >
> >> > - blank line
> >> >
> >> > - import static all other imports
> >> >
> >> >
> >> > [1] https://maven.apache.org/developers/conventions/code.html
> >> > [2] https://checkstyle.sourceforge.io/config_imports.html#ImportOrder
> >> >
> >> > --
> >> > Sławomir Jaranowski
> >> >
> >> > https://twitter.com/SlawekJaran
> >> > https://github.com/slawekjaranowski
> >> > https://linkedin.com/in/slawomirjaranowski
> >>
> >>
> >>
> >> --
> >> Elliotte Rusty Harold
> >> elharo@ibiblio.org
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >>
> >
> > --
> > Sławomir Jaranowski
> >
>
>
> --
> Sławomir Jaranowski
>