1 20 package com.puppycrawl.tools.checkstyle.checks.sizes; 21 22 import com.puppycrawl.tools.checkstyle.api.Check; 23 import com.puppycrawl.tools.checkstyle.api.DetailAST; 24 25 55 public class FileLengthCheck extends Check 56 { 57 58 private static final int DEFAULT_MAX_LINES = 2000; 59 60 61 private int mMaxFileLength = DEFAULT_MAX_LINES; 62 63 64 public int[] getDefaultTokens() 65 { 66 return new int[0]; 67 } 68 69 70 public void beginTree(DetailAST aRootAST) 71 { 72 final String [] lines = getLines(); 73 if (lines.length > mMaxFileLength) { 74 log(1, "maxLen.file", 75 new Integer (lines.length), 76 new Integer (mMaxFileLength)); 77 } 78 } 79 80 83 public void setMax(int aLength) 84 { 85 mMaxFileLength = aLength; 86 } 87 88 } 89 | Popular Tags |