Grunt task for checking the use of profanities in your code
This plugin requires Grunt ~0.4.1
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-profanities --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-profanities');
In your project's Gruntfile, add a section named profanities
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
profanities: {
options: {
// Task-specific options go here.
},
src: {
// Array of file lists go here.
},
},
})
languages: An array of languages. Defaults to 'en'. When different languages are used the profanities list will be read from lib/profanities/#{language}.json file. Refer to en.json for an example.
ignoreWords: An array of profanities to ignore if found on the files.
// bad_comment.js
// This crap always work
function(a){
alert("This function has a nasty comment");
};
// Gruntfile.js
grunt.initConfig({
profanities: {
options: {},
src: {
['test/bad_coment.js']
},
},
})
// spanis_profanity.js
function(a){
alert("Esto es una chinga");
};
// Gruntfile.js
grunt.initConfig({
profanities: {
options: {
languages: ["en", "es"]
},
src: {
['test/bad_coment.js']
},
},
})
- Show file and line where the profanity was discovered
You're welcome to fork this project and send pull requests. Please run grunt
to make sure all file have lint check.
Copyright (c) 2013 Gabriel Cebrian, released under the MIT license. Original profanity list copied from https://github.com/web-mech/badwords