README.md

grunt-sloc

Getting Started

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-sloc --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-sloc');

The "sloc" task

Overview

In your project's Gruntfile, add a section named sloc to the data object passed into grunt.initConfig().

Options

options.reportType

Type: String
Default value: stdout

It will generate a JSON file SLOC analysis results. The default value is stdout.
If we do not specify, in the case of the stdout, If you are prompted to enter the json and output to the CLI on the json file.

options.reportPath

Type: String
Default value: ``

I specify the path where you output the JSON file. Create the root folder if you do not specify if.

options.tolerant

Type: Boolean
Default value: false

Set as false to analyze only files with a subset of popular extensions. true to analyze files with any file extension. The default is false.

If true, the SLOC will be executed on all of the files specified, regardless of file extension. With 'tolerant' set to false, or 'tolerant' unspecified, only supported file extensions will be analyzed.

options.alias

Type: Object
Default value: null

Custom ext to act like standard ext.

eg.

{
php5:'php',
less:'css',
vm:'html'
}

Usage Examples

Basic SLOC

This configuration will count line of the input files using the default options.