It is currently 11 Sep 2025, 12:49
   
Text Size

Look how checkstyle ruins good code!

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Look how checkstyle ruins good code!

Postby Max mtg » 17 Mar 2012, 18:18

There's a class of mine: /trunk/src/main/java/forge/quest/data/item/QuestItemType.java
http://svn.slightlymagic.net/websvn/log ... &peg=14779
Before checkstyle (r14717)

Code: Select all
public enum QuestItemType {
   
    SLEIGHT("Sleight", QuestItemPassive.class, QuestItemCondition.class),
    ESTATES("Estates", QuestItemEstates.class, QuestItemCondition.class),
    LUCKY_COIN("Lucky Coin", QuestItemPassive.class, QuestItemCondition.class),
    MAP("Map", QuestItemPassive.class, QuestItemCondition.class),
    ZEPPELIN("Zeppelin", QuestItemZeppelin.class, QuestItemCondition.class),
    ELIXIR_OF_LIFE("Elixir of Life", QuestItemElixir.class, QuestItemCondition.class),
    POUND_FLESH("Pound of Flesh", QuestItemPoundFlesh.class, QuestItemCondition.class);
   
   
    private final String saveFileKey;
After checkstyle (r14765)
Code: Select all
public enum QuestItemType {

    /** The SLEIGHT. */
    SLEIGHT("Sleight", QuestItemPassive.class, QuestItemCondition.class), /** The ESTATES. */
 ESTATES("Estates", QuestItemEstates.class,
            QuestItemCondition.class),
 /** The LUCK y_ coin. */
 LUCKY_COIN("Lucky Coin", QuestItemPassive.class, QuestItemCondition.class),
 /** The MAP. */
 MAP(
            "Map", QuestItemPassive.class, QuestItemCondition.class),
 /** The ZEPPELIN. */
 ZEPPELIN("Zeppelin", QuestItemZeppelin.class,
            QuestItemCondition.class),
 /** The ELIXI r_ o f_ life. */
 ELIXIR_OF_LIFE("Elixir of Life", QuestItemElixir.class, QuestItemCondition.class),
 /** The POUN d_ flesh. */
 POUND_FLESH(
            "Pound of Flesh", QuestItemPoundFlesh.class, QuestItemCondition.class);

    private final String saveFileKey;
Who still thinks that current checkstyle settings make code better?
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Look how checkstyle ruins good code!

Postby Chris H. » 18 Mar 2012, 14:30

I wonder if this was caused by a script and was not done by hand.

It does look strange.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Look how checkstyle ruins good code!

Postby jendave » 19 Mar 2012, 15:29

I'll remove that setting. It obviously is not working.
jendave
 
Posts: 307
Joined: 01 Jun 2008, 07:19
Has thanked: 8 times
Been thanked: 21 times

Re: Look how checkstyle ruins good code!

Postby Doublestrike » 20 Mar 2012, 06:58

@Jendave - thanks for your efforts in putting in some standards. I enjoy having some guidelines, and a unified, clean code base with standardized formatting and without compiler flags is fantastic, especially with the large pool of developers we enjoy.

While you're digging around in there, could you have a look at the "file does not end with a newline" flag, quite a few files have this flag even though the file does end with a newline. Is there a way I can fix, or should the flag just be disabled?
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: Look how checkstyle ruins good code!

Postby SBeauchamp » 22 Mar 2012, 01:51

Doublestrike wrote:While you're digging around in there, could you have a look at the "file does not end with a newline" flag, quite a few files have this flag even though the file does end with a newline. Is there a way I can fix, or should the flag just be disabled?
I had the same problem as you (I'm using Windows). I've replaced:

Code: Select all
<module name="NewlineAtEndOfFile"/>
with

Code: Select all
<module name="NewlineAtEndOfFile"><property name="lineSeparator" value="lf"/></module>
in the Checkfile parameter file, and it looks like it fixed the problem for me (even if it represents the Unix style newline). I'd be curious if that also does the trick on the other platforms. I'll commit the changes, let me know if it doesn't work properly!

Edit: More info here:
http://checkstyle.sourceforge.net/config_misc.html
http://checkstyle.2069334.n4.nabble.com/Checkstyle-on-Windows-td3831484.html
SBeauchamp
 
Posts: 5
Joined: 18 Mar 2012, 18:58
Has thanked: 1 time
Been thanked: 2 times

Re: Look how checkstyle ruins good code!

Postby silly freak » 22 Mar 2012, 10:13

by the way, eclipse has a setting for which line separator to use. I know you can set it on the file level, I'm not sure it's possible on the project level too. standardizing this might be a good idea.
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 41 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 41 users online :: 0 registered, 0 hidden and 41 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 41 guests

Login Form