🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

grunt-phpcs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-phpcs - npm Package Compare versions

Comparing version

to
0.2.0

php/modules/Grunt/PhpCs/World.php

10

Gruntfile.js

@@ -15,3 +15,3 @@ /*

grunt.initConfig({
jshint: {

@@ -26,10 +26,10 @@ all: [

},
phpcs: {
application: {
dir: 'application/classes'
dir: 'php/modules'
},
options: {
bin: 'vendor/bin/phpcs',
standard: 'Zend'
standard: 'PSR2'
}

@@ -41,3 +41,3 @@ }

grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-jshint');

@@ -44,0 +44,0 @@

@@ -1,2 +0,2 @@

{
{
"name": "grunt-phpcs",

@@ -15,10 +15,10 @@ "description": "Grunt plugin for running PHP Code Sniffer.",

"contributors": [],
"version": "0.1.1",
"version": "0.2.0",
"main": "Gruntfile.js",
"engines": {
"node": ">=0.8.0"
"node": "0.10.x"
},
"devDependencies": {
"grunt-contrib-jshint": "0.1.1rc6",
"grunt": "0.4.0rc6"
"grunt-contrib-jshint": "0.6.0",
"grunt": "0.4.1"
},

@@ -25,0 +25,0 @@ "keywords": [

@@ -82,2 +82,7 @@ # grunt-phpcs

Output more verbose information. This option can also be set by running the task with `--verbose`.
Output more verbose information. This option can also be set by running the task with `--verbose`.
####reportFile
Type: `string` Default: `false`
Log report to the file. This option can also be set by running the task with `--report-file`.

@@ -9,81 +9,13 @@ /*

*/
'use strict';
module.exports = function(grunt) {
'use strict';
var _ = grunt.util._;
var path = require('path');
var exec = require('child_process').exec;
grunt.registerMultiTask( 'phpcs', 'Run phpunit', function() {
var done = this.async();
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({
// Default options
bin: 'phpcs',
debug: false,
extensions: false,
ignore: false,
severity: false,
standard: false,
verbose: false
});
// Normalize dir and cmd.
var dir = path.normalize(this.data.dir);
var cmd = path.normalize(options.bin);
if (grunt.option('debug') || options.debug === true) {
// Display debbuging information during test execution.
cmd += ' --debug';
}
if (grunt.option('extensions') || options.extensions) {
// A comma separated list of file extensions to check
cmd += ' --extensions=' + options.extensions;
}
if (grunt.option('ignore') || options.ignore) {
// A comma separated list of patterns to ignore files and directories.
cmd += ' --ignore=' + options.ignore;
}
if (grunt.option('severity') || options.severity) {
// The minimum severity required to display an error or warning
cmd += ' --severity=' + options.severity;
}
if (grunt.option('verbose') || options.standard) {
// Define the code sniffer standard.
cmd += ' --standard=' + options.standard;
}
if (grunt.option('verbose') || options.verbose === true) {
// Output more verbose information.
cmd += ' -v';
}
// Set working directory.
cmd += ' ' + dir;
grunt.log.writeln('Starting phpcs (target: ' + this.target.cyan + ') in ' + dir.cyan);
grunt.verbose.writeln('Exec: ' + cmd);
// Execute phpunit command.
exec(cmd, function( err, stdout, stderr) {
if (stdout) {
grunt.log.write(stdout);
}
// Internal lib.
var phpcs = require('./lib/phpcs').init(grunt);
if (err) {
grunt.fatal(err);
}
done();
});
});
grunt.registerMultiTask('phpcs', 'Run phpunit', function() {
phpcs.setup(this);
phpcs.run();
});
};