I see the checkstyle and pmd as robots that help us to write core easily
readable by others. These are dummy robots with no "common sense". We can
also help them to understand when a rule is not applicable to certain parts
of our code. Going around rules should not be common place, otherwise it
would be better to change the rules. ;)

The standard checkstyle/pmd rules are what other guys decided what they
think is OK for the majority of projects. In any case, the tools are
flexible enough to (almost?) meet the needs of any project.

So, now I see these options:
* keep as is;
* remove the 'NeedBraces' rule;
* change the 'NeedBraces' rule by removing "if" (and "else"?) from the list
of checked blocks (http://checkstyle.sourceforge.net/config_blocks.html)
* add @SuppressWarnings("checkstyle:needbraces") when needed.
* use "if (bla == null) { return; }"... but it looks as readable as "if
(bla == null) return;"

I don't see a problem with '@SuppressWarnings' as it makes clear what rule
we are bending. Sure, it depends also on the size of the block of code it
covers and how often we use it.

[]s,
Thiago.



On Fri, May 23, 2014 at 7:37 AM, Romain Manni-Bucau
<[email protected]>wrote:

> or do nothing (hehe)
>
> BTW I'd never use @SuppressXXX since when code is touched it is not
> mantained for sure and then if we use so we shouldn't have rules ;).
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-05-23 12:52 GMT+02:00 Thiago Veronezi <[email protected]>:
>
> > Good morning!
> >
> > I think we have two options:
> > * change the rule for 'NeedBraces' (
> > http://checkstyle.sourceforge.net/config_blocks.html)
> > * add @SuppressWarnings("checkstyle:needbraces") when needed.
> >
> > I've just committed a "@SuppressWarnings" example.
> >
> > []s,
> > Thiago.
> >
> >
> >
> > On Fri, May 23, 2014 at 5:25 AM, Jean-Louis Monteiro <
> > [email protected]> wrote:
> >
> > > Not that important, I agree.
> > > Just asking cause I like this way to implement pre conditions in
> methods.
> > >
> > >
> > > --
> > > Jean-Louis Monteiro
> > > http://twitter.com/jlouismonteiro
> > > http://www.tomitribe.com
> > >
> > >
> > > On Fri, May 23, 2014 at 2:21 AM, Romain Manni-Bucau
> > > <[email protected]>wrote:
> > >
> > > > -0, I like having brackets, avoid bugs when updating the code, that
> > said
> > > if
> > > > I'm alone thinking it go for it, this is not that important
> > > >
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > Twitter: @rmannibucau
> > > > Blog: http://rmannibucau.wordpress.com/
> > > > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > > > Github: https://github.com/rmannibucau
> > > >
> > > >
> > > > 2014-05-23 11:18 GMT+02:00 Jean-Louis Monteiro <
> > [email protected]
> > > >:
> > > >
> > > > > Hey guys,
> > > > >
> > > > > Is it possible to restore the ability to have inline if?
> > > > > I like them cause I think it's more readable, especially to write
> pre
> > > > > condition at the beginning of methods.
> > > > >
> > > > > For instance ...
> > > > > if (bla == null) return;
> > > > >
> > > > > Thanks
> > > > >
> > > > > --
> > > > > Jean-Louis Monteiro
> > > > > http://twitter.com/jlouismonteiro
> > > > > http://www.tomitribe.com
> > > > >
> > > >
> > >
> >
>

Reply via email to