Update for CustomDeclarationOrder #73

Closed
romani opened this Issue Nov 3, 2012 · 6 comments

Projects

None yet

3 participants

@romani
Member
romani commented Nov 3, 2012
  1. group Fields with assigning to Anonymous classes;
private successListener = new Listener {
...
// some anonymous class definition, could be few methods definition
....
}
private int value;
private successListener2 = new new Listener {
...
// some anonymous class definition, could be few methods definition
....
}

proposed name for macros ###filed_ann_class###

  1. Setter/Geter (base on bean notation) , notation detection could be taken from https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/SimpleAccessorNameNotationCheck.java
    Marcos: ###getter_setter###
    expected order of declarations - all get/set are grouped and not mixed with other methods of class.
public int getX(){}
public int setX(){}
public int getY(){}
public int setY(){}
  1. include coverage of nested interfaces, nested enumarations
    old :" Options that are "true" by default ignoreInnerInterfaces ignoreInnerEnums"
    new create new macros: InnerInterfaces InnerEnums to help manage it location.
public class MyClass {

    interface CrazyInterface{ .... }
        ....
    }

    enum HiddenEnum{ .... }
        ....
    }
}

  1. include coverage nested classes in methods
    Options that are "true" by default
    ignoreIneerClassesInMethods

Example of bad code:

private methodX (... ) {

class NameC{ .... }
....
}

}// end of methods declaration
  1. Add support for escape symbol "" in regexp (it is required to have in regexp string usage of "(" and ")" symbols - for example describe in format location of "main()" method)
    example of usage in: "........main()...."
    Attention: see Baratali explanation for this feature.

ATTENTION: example of custom order declration format is here https://groups.google.com/d/msg/sevntu-checkstyle/_nOVtWDxPJo/sBb8s2D4lTwJ

@sabaka sabaka was assigned Jun 3, 2013
@baratali baratali was assigned Sep 7, 2013
@baratali
Contributor
  1. We can't create inner interfaces, enums inside a method. Only non-static classes are available.
@romani
Member
romani commented Oct 20, 2013

you are right, I updated the issue description.

@baratali
Contributor
  1. Check does not have rules to process interfaces and enums. So inner interfaces and enums are always ignored. It has: Field, Method, Ctor, InnerClass. Maybe we should add new rules: InnerInterface, InnerEnum. With these rules we don't need options ignoreInnerInterfaces and ignoreInnerEnums.
    For example, if InnerInterface is not mentioned in rules then Check skips inner interfaces. If it is mentioned in rules, e.g. Field(.*) ### Ctor(.*) ### Method(.*) ### InnerInterface(.*), then Check requires proper order.
@baratali
Contributor
  1. It supports escape symbol \. But you can't use ( or ) for identifying method, because Check compares only modifiers and name of method. For main method you can use: <modifiers> main$. But you can't check methods arguments.
@romani
Member
romani commented Oct 24, 2013
  1. Check does not

Yes we need to ignore them. Looks like smth was lost from original problem .... . Yes please add support for new tags InnerInterface and InnerEnum to allow us manage their location, and forget about "ignoreInnerInterfaces and ignoreInnerEnums".

  1. It supports

Make sense. Please skip that point. thanks a lot.

@baratali
Contributor
baratali commented Nov 5, 2013
  1. Introduce new rule for main method. Macro: MainMethod
@romani romani closed this Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment