Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"grunt-shell": "~0.7.0",
"grunt-parallel-behat": "git+https://github.com/arithmetric/grunt-parallel-behat.git",
"grunt-phplint": "~0.0.5",
"grunt-phpcs": "~0.2.2",
"grunt-phpcs": "git+https://github.com/grayside/grunt-phpcs.git#0.3.0",
"grunt-contrib-compress": "~0.9.1",
"grunt-phpmd": "~0.1.0",
"time-grunt": "^0.4.0",
Expand Down
35 changes: 0 additions & 35 deletions tasks/analyze.js

This file was deleted.

119 changes: 119 additions & 0 deletions tasks/quality.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
module.exports = function(grunt) {

/**
* Define "validate" and "analyze" tasks, and include required plugins.
*
* These tasks are used to ensure code quality.
*
* grunt validate
* Evaluate the quality of all custom code to make sure it is safe to push.
* Should be reasonably fast and display on the command-line.
*
* grunt analyze
* Deeper inspection & analyze of codebase, not done on every build.
* Produces reports for Jenkins. May be a long-running task.
*/
grunt.loadTasks(__dirname + '/../node_modules/grunt-phplint/tasks');
grunt.loadTasks(__dirname + '/../node_modules/grunt-phpcs/tasks');
grunt.loadTasks(__dirname + '/../node_modules/grunt-phpmd/tasks');

// Task set aliases are registered at the end of the file based on these values.
var validate = [];
var analyze = [];

grunt.config('phplint', {
all: [
'<%= config.srcPaths.drupal %>/**/*.php',
'<%= config.srcPaths.drupal %>/**/*.module',
'<%= config.srcPaths.drupal %>/**/*.inc',
'<%= config.srcPaths.drupal %>/**/*.install',
'<%= config.srcPaths.drupal %>/**/*.profile',
'!<%= config.srcPaths.drupal %>/**/*.features.*inc',
'!<%= config.srcPaths.drupal %>/sites/**'
],
});
validate.push('phplint:all');

if (grunt.config.get('config.phpcs') != undefined) {
var phpcs = [
'<%= config.srcPaths.drupal %>/**/*.php',
'<%= config.srcPaths.drupal %>/**/*.module',
'<%= config.srcPaths.drupal %>/**/*.inc',
'<%= config.srcPaths.drupal %>/**/*.install',
'<%= config.srcPaths.drupal %>/**/*.profile',
'<%= config.srcPaths.drupal %>/**/*.css',
'!<%= config.srcPaths.drupal %>/**/*.features.*inc',
'!<%= config.srcPaths.drupal %>/sites/**'
];
grunt.config('phpcs', {
analyze: {
dir: phpcs
},
drupal: {
dir: phpcs
},
validate: {
dir: phpcs,
report: grunt.config.get('config.phpcs.validateReport') || 'summary',
reportFile: false,
},
full: {
dir: phpcs,
report: 'full',
reportFile: false
},
summary: {
dir: phpcs,
report: 'summary',
reportFile: false
},
gitblame: {
dir: phpcs,
report: 'gitblame',
reportFile: false
},
options: {
bin: '<%= config.phpcs.path %>',
standard: '<%= config.phpcs.standard %>',
extensions: 'php,install,module,inc,profile',
ignoreExitCode: true,
report: 'checkstyle',
reportFile: '<%= config.buildPaths.reports %>/phpcs.xml'
}
});

validate.push('phpcs:validate');
analyze.push('phpcs:analyze');
}

if (grunt.config.get('config.phpmd') != undefined) {
var phpmdConfig = grunt.config.get('config.phpmd.configPath') || 'phpmd.xml';
grunt.config('phpmd', {
custom: {
dir: '<%= config.srcPaths.drupal %>/'
},
options: {
bin: '<%= config.phpmd.path %>',
rulesets: phpmdConfig,
suffixes: "php,module,inc,install,profile",
exclude: "<%= config.srcPaths.drupal %>/sites",
reportFormat: 'xml',
reportFile: '<%= config.buildPaths.reports %>/phpmd.xml'
}
});
analyze.push('phpmd:custom');
}

grunt.registerTask('validate', validate);
grunt.registerTask('analyze', analyze);

grunt.config('help.validate', {
group: 'Testing & Code Quality',
description: 'Quick code health check for syntax errors and basic practices. (e.g., PHPCS w/ Drush Coder rules)'
});
grunt.config('help.analyze', {
group: 'Testing & Code Quality',
description: 'Static codebase analysis to detect problems. Outputs Jenkins-compatible reports. (e.g., PHPMD)'
});

};
52 changes: 0 additions & 52 deletions tasks/validate.js

This file was deleted.

File renamed without changes.