You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Philippe Laflamme <tw...@gmail.com> on 2010/11/17 15:27:02 UTC

Shiro code conventions

Hi,

Working on an extension to Shiro and would like to format the code with
Shiro's conventions. Does Shiro use its own conventions or uses Sun's or
Eclipse's? Is there an Eclipse formatter settings (XML file) available?

Thanks!
Philippe
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5747873.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro code conventions

Posted by Les Hazlewood <lh...@apache.org>.
Sounds good!  But please attach it to a Jira issue to ensure we meet
IP clearance (all ASF Jira code/artifact submissions are contributed
under the Apache 2.0 license).

Best,

Les

On Thu, Nov 18, 2010 at 6:25 AM, Philippe Laflamme <tw...@gmail.com> wrote:
>
> My preference is also for space-only indentation. It also makes line wrapping
> consistent.
>
> I can build and send you the (hopefully) equivalent Eclipse code formatter
> file. Let me know of any modifications you make to the Java conventions,
> doing it this way should result in an equivalent formatter...
>
> Cheers,
> Philippe
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5751837.html
> Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro code conventions

Posted by Philippe Laflamme <tw...@gmail.com>.
My preference is also for space-only indentation. It also makes line wrapping
consistent.

I can build and send you the (hopefully) equivalent Eclipse code formatter
file. Let me know of any modifications you make to the Java conventions,
doing it this way should result in an equivalent formatter...

Cheers,
Philippe
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5751837.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro code conventions

Posted by Les Hazlewood <lh...@apache.org>.
Ah, I see what you mean.

Sure, that makes sense.  The biggest benefit of having an actual
format that you can use for patches (like something the IDE will
understand) is that version control 'noise' is greatly reduced.  That
is, you can see the real effect of a logic change instead of having to
wade through whitespace/formatting changes.

Until now, I've always used spaces for indentation and never tabs.  As
for the eclipse file, I wouldn't have any information on that - I use
IDEA for everything.  I'd be happy to post my idea config if people
are curious.

I think we should create a wiki page for this and have those two files
as attachments.

Cheers,

Les

On Wed, Nov 17, 2010 at 9:19 AM, Philippe Laflamme <tw...@gmail.com> wrote:
>
> Hi Les,
>
> I agree. Personally, my only issue with Sun's convention is that they mix
> spaces and tabs for indentation. I think you should pick either one, but not
> both. Mixing both results in having the downside of using spaces-only AND
> the downsides of using tabs-only indents.
>
> As a side note, I would suggest to officially pick a code convention for
> Shiro and publish the associated Eclipse XML file on the Web Site. Many
> open-source projects do this; it helps submitting patches/extensions.
>
> Thanks,
> Philippe
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5748606.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Re: Shiro code conventions

Posted by Philippe Laflamme <tw...@gmail.com>.
Another example: http://www.springsource.org/jira (scroll all the way down).
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5748669.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro code conventions

Posted by Tamás Cservenák <ta...@cservenak.net>.
Hi,

to chime in, an example of Philippe's intention:

http://maven.apache.org/developers/conventions/code.html

Thanksl,
~t~

On Wed, Nov 17, 2010 at 6:19 PM, Philippe Laflamme <tw...@gmail.com>wrote:

>
> Hi Les,
>
> I agree. Personally, my only issue with Sun's convention is that they mix
> spaces and tabs for indentation. I think you should pick either one, but
> not
> both. Mixing both results in having the downside of using spaces-only AND
> the downsides of using tabs-only indents.
>
> As a side note, I would suggest to officially pick a code convention for
> Shiro and publish the associated Eclipse XML file on the Web Site. Many
> open-source projects do this; it helps submitting patches/extensions.
>
> Thanks,
> Philippe
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5748606.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Re: Shiro code conventions

Posted by Philippe Laflamme <tw...@gmail.com>.
Hi Les,

I agree. Personally, my only issue with Sun's convention is that they mix
spaces and tabs for indentation. I think you should pick either one, but not
both. Mixing both results in having the downside of using spaces-only AND
the downsides of using tabs-only indents.

As a side note, I would suggest to officially pick a code convention for
Shiro and publish the associated Eclipse XML file on the Web Site. Many
open-source projects do this; it helps submitting patches/extensions.

Thanks,
Philippe
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5748606.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro code conventions

Posted by Les Hazlewood <lh...@apache.org>.
Unless I'm mistaken in some piece of code that I'm not aware of, the
entire codebase uses Sun's default conventions.

Since there can be a religious war based on formatting, in my
experience the best approach is to just choose one (no matter what it
is) and go with it.  I have always used the Sun defaults because that
has the highest exposure to other developers and it is what most IDEs
default to, thereby ensuring the easiest adoption path.

HTH!

Les

On Wed, Nov 17, 2010 at 6:27 AM, Philippe Laflamme <tw...@gmail.com> wrote:
>
> Hi,
>
> Working on an extension to Shiro and would like to format the code with
> Shiro's conventions. Does Shiro use its own conventions or uses Sun's or
> Eclipse's? Is there an Eclipse formatter settings (XML file) available?
>
> Thanks!
> Philippe
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-code-conventions-tp5747873p5747873.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>