Skip to content

Commit

Permalink
Added PHPCS dependency and grunt task
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Sep 13, 2016
1 parent 5de8dd0 commit 486449b
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ Thumbs.db
# Logs
/logs

# Composer
/vendor/
31 changes: 27 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ module.exports = function( grunt ) {
},
files: {
src: [
'**/*.php', // Include all files
'!apigen/**', // Exclude apigen/
'**/*.php', // Include all files
'!apigen/**', // Exclude apigen/
'!node_modules/**', // Exclude node_modules/
'!tests/**', // Exclude tests/
'!tmp/**' // Exclude tmp/
'!tests/**', // Exclude tests/
'!vendor/**', // Exclude vendor/
'!tmp/**' // Exclude tmp/
],
expand: true
}
Expand All @@ -226,6 +227,27 @@ module.exports = function( grunt ) {
apigen: {
src: [ 'wc-apidocs' ]
}
},

// PHP Code Sniffer.
phpcs: {
options: {
bin: 'vendor/bin/phpcs',
standard: './phpcs.ruleset.xml'
},
dist: {
src: [
'**/*.php', // Include all files
'!apigen/**', // Exclude apigen/
'!includes/api/legacy/**', // Exclude legacy REST API
'!includes/gateways/simplify-commerce/includes/Simplify/**', // Exclude simplify commerce SDK
'!includes/libraries/**', // Exclude libraries/
'!node_modules/**', // Exclude node_modules/
'!tests/**', // Exclude tests/
'!tmp/**', // Exclude tmp/
'!vendor/**' // Exclude vendor/
]
}
}
});

Expand All @@ -240,6 +262,7 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-phpcs' );

// Register tasks
grunt.registerTask( 'default', [
Expand Down
11 changes: 11 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,16 @@
"license": "GPL-2.0+",
"require": {
"composer/installers": "~1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"wimg/php-compatibility": "*",
"simplyadmire/composer-plugins" : "@dev"
},
"scripts": {
"post-install-cmd": [
"./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs vendor/wimg/php-compatibility"
]
}
}
Loading

0 comments on commit 486449b

Please sign in to comment.