1 package com.mycompany.checks; 2 3 import java.io.File ; 4 import com.puppycrawl.tools.checkstyle.api.*; 5 6 15 public class LimitImplementationFiles 16 extends AbstractFileSetCheck 17 { 18 22 private int max = 100; 23 24 30 public void setMax(int aMax) 31 { 32 max = aMax; 33 } 34 35 38 public void process(File [] files) 39 { 40 if (files != null && files.length > max) { 41 42 final String path = files[max].getPath(); 44 45 getMessageCollector().reset(); 49 50 MessageDispatcher dispatcher = getMessageDispatcher(); 52 53 dispatcher.fireFileStarted(path); 55 56 log(0, "max.files.exceeded", new Integer (max)); 58 59 62 fireErrors(path); 64 65 dispatcher.fireFileFinished(path); 67 } 68 } 69 } 70 | Popular Tags |