Completed
Push — master ( 4aa025...5699f6 )
by
unknown
08:06
created

Gruntfile.js (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
/*global exports:false, module:false, require:false */
0 ignored issues
show
exports does not seem to be used.
Loading history...
2
3
module.exports = function( grunt ) {
4
	'use strict';
5
6
	require('matchdep').filterDev('grunt-*').forEach( grunt.loadNpmTasks );
7
8
	grunt.initConfig({
9
10
		jshint: {
11
			options: {
12
				jshintrc: '.jshintrc'
13
			},
14
			plugin: [
15
				'Gruntfile.js',
16
				'wpsc-admin/js/*.js',
17
				'wpsc-components/marketplace-core-v1/static/*.js',
18
				'wpsc-components/merchant-core-v3/gateways/*.js',
19
				'wpsc-components/theme-engine-v2/admin/js/*.js',
20
				'wpsc-components/theme-engine-v2/theming/assets/js/*.js',
21
				'wpsc-components/merchant-core-v3/*.js',
22
				'wpsc-core/js/*.js',
23
				'!wpsc-core/js/tinymce/*.js',
24
				'!wpsc-core/js/*-min.js',
25
				'!wpsc-core/js/jquery*.js',
26
				'!wpsc-admin/js/admin-legacy.js',
27
				'!wpsc-admin/js/jquery-*.js'
28
			]
29
		},
30
		// Check textdomain errors.
31
		checktextdomain: {
32
			options:{
33
				text_domain: 'wp-e-commerce',
34
				keywords: [
35
					'__:1,2d',
36
					'_e:1,2d',
37
					'_x:1,2c,3d',
38
					'esc_html__:1,2d',
39
					'esc_html_e:1,2d',
40
					'esc_html_x:1,2c,3d',
41
					'esc_attr__:1,2d',
42
					'esc_attr_e:1,2d',
43
					'esc_attr_x:1,2c,3d',
44
					'_ex:1,2c,3d',
45
					'_n:1,2,4d',
46
					'_nx:1,2,4c,5d',
47
					'_n_noop:1,2,3d',
48
					'_nx_noop:1,2,3c,4d'
49
				]
50
			},
51
			files: {
52
				src:  [
53
					'**/*.php', // Include all files
54
					'!node_modules/**', // Exclude node_modules/
55
					'!tests/**', // Exclude tests/
56
					'!bin/**', // Exclude bin/
57
					'!tmp/**' // Exclude tmp/
58
				],
59
				expand: true
60
			}
61
		},
62
63
		makepot: {
64
			target: {
65
				options: {
66
					domainPath: '/wpsc-languages/',    // Where to save the POT file.
67
					exclude: [
68
								'tesst/.*',
69
								'bin/.*',
70
								'images/.*'
71
							],
72
					mainFile: 'wp-shopping-cart.php',    // Main project file.
73
					potFilename: 'wp-e-commerce.pot',    // Name of the POT file.
74
					potHeaders: {
75
					poedit: true,                 // Includes common Poedit headers.
76
						'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
77
					},
78
					type: 'wp-plugin',    // Type of project (wp-plugin or wp-theme).
79
					updateTimestamp: true,    // Whether the POT-Creation-Date should be updated without other changes.
80
					processPot: function( pot, options ) {
0 ignored issues
show
options does not seem to be used.
Loading history...
81
						pot.headers['report-msgid-bugs-to'] = 'https://wpecommerce.org/';
82
						pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)';
83
						pot.headers['language-team'] = 'WP-Translations <[email protected]>';
84
						pot.headers['language'] = 'en_US';
85
						return pot;
86
					}
87
				}
88
			}
89
		},
90
		watch: {
91
			js: {
92
				files: ['<%= jshint.plugin %>'],
93
				tasks: ['jshint']
94
			}
95
		}
96
97
	});
98
99
	grunt.registerTask('default', ['jshint', 'watch', 'makepot']);
100
101
	/**
102
	 * PHP Code Sniffer using WordPress Coding Standards.
103
	 *
104
	 * @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
105
	 */
106
	grunt.registerTask('phpcs', function() {
107
		var done = this.async();
108
109
		grunt.util.spawn({
110
			cmd: 'phpcs',
111
			args: [
112
				'-p',
113
				'-s',
114
				'--standard=WordPress',
115
				'--extensions=php',
116
				'--ignore=*/node_modules/*,*/tests/*',
117
				'--report-file=codesniffs.txt',
118
				'.'
119
			],
120
			opts: { stdio: 'inherit' }
121
		}, done);
122
	});
123
124
};