grunt-check-copyright
Grunt plugin to check if copyright is present in files
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-check-copyright --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "check_copyright" task
Overview
In your project's Gruntfile, add a section named check_copyright
to the data object passed into grunt.initConfig()
.
grunt;
Options
options.copyrights
Type: Array
Default value: [/(Copyright .*\. All Rights Reserved\.)/]
An array containing the various copyrights to check in the list of files specified.
options.lines
Type: Number
Default value: 5
A number value that is used to check a file first 'n' lines for the copyright.
Usage Examples
Default Options
In this example, the default options are used to do something with whatever. So if the fixtures
folder has the files fail.html
, fail.js
, pass.html
and pass.js
, the file options only filters for the js
files as per the pattern and the generated result in this case would be fail.js
since this file doesn't have the copyright notice.
Note: Here we use the default options for lines and copyright as specified here.
grunt;
Custom Options
In this example, custom options are used to do something else with whatever else. So if the fixtures
folder has the files fail.html
, fail.js
, pass.html
and pass.js
, the file options only filters for the html
files as per the pattern and the generated result in this case would be fail.html
since this file doesn't have the copyright notice.
Also, you can see that the copyrights
array is trying to match two different format of copyright.
grunt;
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
(Nothing yet)