File tree Expand file tree Collapse file tree 4 files changed +34
-4
lines changed
src/main/java/com/smlnskgmail/jaman/checkstyle/checks Expand file tree Collapse file tree 4 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ Add to `TreeWalker` module:
4242<module name =" com.smlnskgmail.jaman.checkstyle.checks.AndroidViewFieldNameCheck" >
4343 <property name =" id" value =" AndroidViewFieldNameCheck" />
4444</module >
45- <module name =" com.smlnskgmail.jaman.checkstyle.checks.ContextFirstParameterCheck " >
45+ <module name =" com.smlnskgmail.jaman.checkstyle.checks.ContextAsFirstParameterCheck " >
4646 <property name =" id" value =" ContextFirstParameterCheck" />
4747</module >
4848<module name =" com.smlnskgmail.jaman.checkstyle.checks.MethodObjectReturnAnnotationCheck" >
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ plugins {
55}
66
77group ' com.smlnskgmail.jaman.checkstyle'
8- version ' 1.1 .0'
8+ version ' 1.2 .0'
99
1010checkstyle {
1111 toolVersion ' 8.38'
Original file line number Diff line number Diff line change @@ -14,6 +14,36 @@ public void visitToken(DetailAST ast) {
1414 if (identifier != null ) {
1515 String fieldClassName = identifier .getText ();
1616 switch (fieldClassName ) {
17+ case "LinearLayout" :
18+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("lv" )) {
19+ log (ast );
20+ }
21+ break ;
22+ case "RelativeLayout" :
23+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("rl" )) {
24+ log (ast );
25+ }
26+ break ;
27+ case "ConstraintLayout" :
28+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("cl" )) {
29+ log (ast );
30+ }
31+ break ;
32+ case "FrameLayout" :
33+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("fl" )) {
34+ log (ast );
35+ }
36+ break ;
37+ case "ScrollView" :
38+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("sv" )) {
39+ log (ast );
40+ }
41+ break ;
42+ case "HorizontalScrollView" :
43+ if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("hsv" )) {
44+ log (ast );
45+ }
46+ break ;
1747 case "TextView" :
1848 if (!ast .findFirstToken (TokenTypes .IDENT ).getText ().startsWith ("tv" )) {
1949 log (ast );
Original file line number Diff line number Diff line change 44import com .puppycrawl .tools .checkstyle .api .DetailAST ;
55import com .puppycrawl .tools .checkstyle .api .TokenTypes ;
66
7- public class ContextFirstParameterCheck extends AbstractCheck {
7+ public class ContextAsFirstParameterCheck extends AbstractCheck {
88
9- private static final String MESSAGE_KEY = "ContextFirstParameterCheck " ;
9+ private static final String MESSAGE_KEY = "ContextAsFirstParameterCheck " ;
1010
1111 @ Override
1212 public void visitToken (DetailAST ast ) {
You can’t perform that action at this time.
0 commit comments