blob: 5cba9a561acc798ee806ddf7229d3428c397a32e [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<head>
<title>Before Execution File Filters</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
<script type="text/javascript" src="js/anchors.js"/>
<script type="text/javascript" src="js/google-analytics.js"/>
<link rel="icon" href="images/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
</head>
<body>
<section name="Content">
<macro name="toc">
<param name="fromDepth" value="1"/>
<param name="toDepth" value="1"/>
</macro>
</section>
<section name="BeforeExecutionExclusionFileFilter">
<subsection name="Description">
<p>Since Checkstyle 7.2</p>
<p>
File filter <code>BeforeExecutionExclusionFileFilter</code> decides which files should be
excluded from being processed by the utility.
</p>
<p>
By default Checkstyle includes all files and sub-directories in a directory to be
processed and checked for violations. Users could have files that are in these
sub-directories that shouldn't be processed with their checkstyle configuration for
various reasons, one of which is a valid Java file that won't pass Checkstyle's parser.
When Checkstyle tries to parse a Java file and fails, it will throw an
<code>Exception</code> and halt parsing any more files for violations. An example of a
valid Java file Checkstyle can't parse is JDK 9's <code>module-info.java</code>.
This file filter will exclude these problem files from being parsed,
allowing the rest of the files to run normal and be validated.
</p>
<p>
<b>Note:</b> When a file is excluded from the utility, it is excluded from all Checks and
no testing for violations will be performed on them.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>fileNamePattern</td>
<td>Regular expression to match the file name against.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>null</code></td>
<td>7.2</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the filter to exclude all 'module-info.java' files:
</p>
<source>
&lt;module name=&quot;BeforeExecutionExclusionFileFilter&quot;&gt;
&lt;property name=&quot;fileNamePattern&quot; value=&quot;module\-info\.java$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+BeforeExecutionExclusionFileFilter">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filefilters </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
</body>
</document>