Skip to content

ForbidTokensAtLineEnd #125

Closed
romani opened this Issue Aug 11, 2013 · 4 comments

4 participants

@romani
open source initiative member
romani commented Aug 11, 2013

Condition:

        return methodType.getType() == TokenTypes.ARRAY_DECLARATOR ||
                mCollectionList.contains(methodType.getText());

better condition:

        return methodType.getType() == TokenTypes.ARRAY_DECLARATOR
                || mCollectionList.contains(methodType.getText());

All conditions at : http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html

The same problem for "," and ".":
bad:

        return new JPAQuery(em)
                from(teamInGame).
                limit(1L).
                uniqueResult(teamInGame.teamInSeason.season);

good (https://github.com/isopov/fan/blob/master/fan-core/src/main/java/com/sopovs/moradanen/fan/service/DaoService.java):

        return new JPAQuery(em)
                .from(teamInGame)
                .limit(1L)
                .uniqueResult(teamInGame.teamInSeason.season);

good:

getGames(firstTeamId
      , secondTeamId
      , size
      ,  startFrom);

bad:

getGames(firstTeamId, 
         secondTeamId, 
         size,  
         startFrom);

Task: create Check that will allow user to forbid presence of Token (selected in options of Check) at the end of any line (condition, method declaration, call of function, ..... ). Do not put token ";" in list tokens. I do believe we need to focus on conditions, "+-", ".," ... anything that could be used inside one command (http://www.quepublishing.com/articles/article.aspx?p=28697&seqNum=4).

@alexkravin alexkravin was assigned by daniilyar Apr 9, 2014
@rdiachenko
open source initiative member

The case with operators is already covered by OperatorWrap check

@romani
open source initiative member
romani commented Jul 7, 2014

OperatorWrap does not cover all cases , new check was created maxvetrenko/checkstyle#10

@romani romani assigned romani and unassigned alexkravin Jul 7, 2014
@daniilyar
open source initiative member

So, could we close this issue?

@romani
open source initiative member
romani commented Jul 20, 2014
@romani romani closed this Jul 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.