Skip to content

Files

Latest commit

 

History

History
40 lines (31 loc) · 1.43 KB

HeaderMatches.md

File metadata and controls

40 lines (31 loc) · 1.43 KB

Pattern: Malformed file header

Issue: -

Description

A lot of projects require a header with a copyright notice, or they require a license in each file. This does a simple text comparison between the header and the first lines of the file. You can have multiple lines, but make sure you surround the text with a CDATA section. You can also specify a regular expression, as long as you set the regex parameter to true.

Parameters

NameDescriptionTypeDefault Value
header Header string

Example configuration

<check enabled="true" class="org.scalastyle.file.HeaderMatchesChecker" level="warning">
 <parameters>
  <parameter name="regex">false</parameter>
  <parameter name="header">// Copyright \(C\) 2011-2012 the original author or authors.</parameter>
 </parameters>
</check>

or

<check enabled="true" class="org.scalastyle.file.HeaderMatchesChecker" level="warning">
 <parameters>
  <parameter name="regex">true</parameter>
  <parameter name="header">// Copyright \(C\) (?:\d{4}-)?\d{4} the original author or authors.</parameter>
 </parameters>
</check>