Coverage Report - com.puppycrawl.tools.checkstyle.filters.SuppressionFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
SuppressionFilter
0%
0/11
0%
0/2
1.4
 
 1  
 ////////////////////////////////////////////////////////////////////////////////
 2  
 // checkstyle: Checks Java source code for adherence to a set of rules.
 3  
 // Copyright (C) 2001-2014  Oliver Burn
 4  
 //
 5  
 // This library is free software; you can redistribute it and/or
 6  
 // modify it under the terms of the GNU Lesser General Public
 7  
 // License as published by the Free Software Foundation; either
 8  
 // version 2.1 of the License, or (at your option) any later version.
 9  
 //
 10  
 // This library is distributed in the hope that it will be useful,
 11  
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
 // Lesser General Public License for more details.
 14  
 //
 15  
 // You should have received a copy of the GNU Lesser General Public
 16  
 // License along with this library; if not, write to the Free Software
 17  
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  
 ////////////////////////////////////////////////////////////////////////////////
 19  
 package com.puppycrawl.tools.checkstyle.filters;
 20  
 
 21  
 import com.puppycrawl.tools.checkstyle.api.AuditEvent;
 22  
 import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
 23  
 import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
 24  
 import com.puppycrawl.tools.checkstyle.api.Filter;
 25  
 import com.puppycrawl.tools.checkstyle.api.FilterSet;
 26  
 
 27  
 /**
 28  
  * <p>
 29  
  * This filter accepts AuditEvents according to file, check, line, and
 30  
  * column, as specified in a suppression file.
 31  
  * </p>
 32  
  * @author Rick Giles
 33  
  */
 34  0
 public class SuppressionFilter
 35  
     extends AutomaticBean
 36  
     implements Filter
 37  
 {
 38  
     /** set of individual suppresses */
 39  0
     private FilterSet mFilters = new FilterSet();
 40  
 
 41  
     /**
 42  
      * Loads the suppressions for a file.
 43  
      * @param aFileName name of the suppressions file.
 44  
      * @throws CheckstyleException if there is an error.
 45  
      */
 46  
     public void setFile(String aFileName)
 47  
         throws CheckstyleException
 48  
     {
 49  0
         mFilters = SuppressionsLoader.loadSuppressions(aFileName);
 50  0
     }
 51  
 
 52  
     /** {@inheritDoc} */
 53  
     public boolean accept(AuditEvent aEvent)
 54  
     {
 55  0
         return mFilters.accept(aEvent);
 56  
     }
 57  
 
 58  
     @Override
 59  
     public String toString()
 60  
     {
 61  0
         return mFilters.toString();
 62  
     }
 63  
 
 64  
     @Override
 65  
     public int hashCode()
 66  
     {
 67  0
         return mFilters.hashCode();
 68  
     }
 69  
 
 70  
     @Override
 71  
     public boolean equals(Object aObject)
 72  
     {
 73  0
         if (aObject instanceof SuppressionFilter) {
 74  0
             final SuppressionFilter other = (SuppressionFilter) aObject;
 75  0
             return this.mFilters.equals(other.mFilters);
 76  
         }
 77  0
         return false;
 78  
     }
 79  
 }