| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /* global module, require */ |
||
| 2 | module.exports = function( grunt ) { |
||
| 3 | 'use strict'; |
||
| 4 | |||
| 5 | // Load all grunt tasks |
||
| 6 | require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); |
||
| 7 | |||
| 8 | // Project configuration |
||
| 9 | grunt.initConfig( { |
||
| 10 | pkg: grunt.file.readJSON( 'package.json' ), |
||
| 11 | |||
| 12 | clean : { |
||
| 13 | dist: ['dist/'] |
||
| 14 | }, |
||
| 15 | |||
| 16 | copy: { |
||
| 17 | dist: { |
||
| 18 | files : [ |
||
| 19 | { |
||
| 20 | expand: true, |
||
| 21 | src: [ |
||
| 22 | '**', |
||
| 23 | '!dist/**', |
||
| 24 | '!assets-wp-repo/**', |
||
| 25 | '!node_modules/**', |
||
| 26 | '!assets/vendor/**', |
||
| 27 | '!assets/js/src/**', |
||
| 28 | '!assets/css/src/**', |
||
| 29 | '!Gruntfile.js', |
||
| 30 | '!bower.json', |
||
| 31 | '!package.json', |
||
| 32 | '!phpcs.xml', |
||
| 33 | '!phpdoc.dist.xml', |
||
| 34 | '!phpunit.xml.dist', |
||
| 35 | '!bin/**', |
||
| 36 | '!tests/**', |
||
| 37 | '!.idea/**', |
||
| 38 | '!tags' |
||
| 39 | ], |
||
| 40 | dest: 'dist/' |
||
| 41 | } |
||
| 42 | ] |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } ); |
||
| 46 | |||
| 47 | require('time-grunt')(grunt); |
||
| 48 | |||
| 49 | grunt.registerTask('build', ['clean', 'copy:dist']); |
||
| 50 | |||
| 51 | grunt.util.linefeed = '\n'; |
||
| 52 | }; |
||
| 53 |