Look how checkstyle ruins good code!
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
6 posts
• Page 1 of 1
Look how checkstyle ruins good code!
by 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)
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;
- 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;
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!
by 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.
It does look strange.
-
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!
by jendave » 19 Mar 2012, 15:29
I'll remove that setting. It obviously is not working.
Re: Look how checkstyle ruins good code!
by 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?
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.
A joke is a very serious thing.
-
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!
by SBeauchamp » 22 Mar 2012, 01:51
I had the same problem as you (I'm using Windows). I've replaced: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?
- Code: Select all
<module name="NewlineAtEndOfFile"/>
- Code: Select all
<module name="NewlineAtEndOfFile"><property name="lineSeparator" value="lf"/></module>
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!
by 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!
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
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 41 guests