java - Is it possible to limit the number of lines of code in a method without empty line breaks between them with CheckStyle? -
i want check style limit code this:
string somevariable = "value"; int val = getnum(somevariable); someobject obj = someobject.callit(val); dosomethingunrelated(); int result = anotherobject.doit( 1, obj, anenum.value ); return result;
that code has many lines in row no separation. want throw warning.
but want allow if it's args method call has lot of parameters:
int result = anotherobject.doit( 1, obj, anenum.value, 23, someotherobject, "/some/file/path", "this lot of params" );
is possible both of requirements in checkstyle?
code has many lines in row no separation
there nothing specific in checkstyle. closest check methodlengthcheck
counts max lines in method. difference want reset count 0 if empty line found printing violations on more x statements in row no line separation. you have write own check, , use methodlengthcheck
foundation if don't want start scratch.
if successful writing check, feel free contribute sevntu.
want allow if it's args method call has lot of parameters
this requirement may not easy accomplish since method calls embedded in statement, can suppress these situations if can't make check find , ignore them.
Comments
Post a Comment