58 lines
2.2 KiB
HTML
58 lines
2.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<title>Checks for Headers</title>
|
|
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Checks for Headers</h1>
|
|
|
|
<p>The property <span class="code">checkstyle.header.file</span> controls
|
|
whether to check that each file begins with a specified header. The header
|
|
contents are specified in the file. If no file is specified, checkstyle does
|
|
not check for a header. The property type is
|
|
<a href="property_types.html#string">string</a> and defaults to
|
|
<span class="default">null</span> (which means do not check).</p>
|
|
|
|
<p>The property <span class="code">checkstyle.header.ignoreline</span>
|
|
specifies the line numbers to ignore when matching lines in a header file. The
|
|
property type is <a href="property_types.html#intSet">integer set</a> and
|
|
defaults to an empty list.</p>
|
|
|
|
<p>This property is very useful for supporting headers that contain copyright
|
|
dates. For example, consider the following header:</p>
|
|
|
|
<pre>
|
|
line 1: ///////////////////////////////////////////////////////////////////////
|
|
line 2: // checkstyle: Checks Java source code for adherence to a set of rules.
|
|
line 3: // Copyright (C) 2001 Oliver Burn
|
|
line 4: ///////////////////////////////////////////////////////////////////////
|
|
</pre>
|
|
|
|
<p>Since the year information will change over time, you can tell checkstyle
|
|
to ignore line 3 by setting the property to <span class="code">3</span>.</p>
|
|
|
|
<p>The property <span class="code">checkstyle.header.regexp</span> controls
|
|
whether to interpret each header line as a regular expression. The property
|
|
type is <a href="property_types.html#boolean">boolean</a> and defaults to
|
|
<span class="default">false</span>.</p>
|
|
|
|
<p>For example, consider the following header when regular expression checking
|
|
is turned on:</p>
|
|
|
|
<pre>
|
|
line 1: /{71}
|
|
line 2: // checkstyle: Checks Java source code for adherence to a set of rules\.
|
|
line 3: // Copyright \(C\) \d\d\d\d Oliver Burn
|
|
line 4: // Last modification by \$Author.*\$
|
|
line 5: /{71}
|
|
</pre>
|
|
|
|
<p>Lines 1 and 5 demonstrate a more compact notation for 71 '/'
|
|
characters. Line 3 enforces that the copyright notice includes a four digit
|
|
year. Line 4 is an example how to enforce revision control keywords in a file
|
|
header.</p>
|
|
|
|
</body>
|
|
</html> |