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
Unused Code
introduced
by
![]() |
|||
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 | |||
31 | sass: { |
||
32 | dist: { |
||
33 | options: { |
||
34 | style: 'expanded', |
||
35 | lineNumbers: false |
||
36 | }, |
||
37 | files: [{ |
||
38 | expand: true, |
||
39 | cwd: 'wpsc-components/theme-engine-v2/theming/assets/scss', |
||
40 | src: ['**/*.scss'], |
||
41 | dest: 'wpsc-components/theme-engine-v2/theming/assets/css/', |
||
42 | ext: '.css' |
||
43 | }] |
||
44 | } |
||
45 | }, |
||
46 | |||
47 | cmq: { |
||
48 | options: { |
||
49 | log: false |
||
50 | }, |
||
51 | dist: { |
||
52 | files: [{ |
||
53 | expand: true, |
||
54 | cwd: 'wpsc-components/theme-engine-v2/theming/assets/css', |
||
55 | src: ['*.css', '!*.min.css', '!wpsc-components/theme-engine-v2/theming/assets/css/font-awesome-ie7.css'], |
||
56 | dest: 'wpsc-components/theme-engine-v2/theming/assets/css/' |
||
57 | }] |
||
58 | } |
||
59 | }, |
||
60 | |||
61 | cssmin: { |
||
62 | target: { |
||
63 | files: [{ |
||
64 | expand: true, |
||
65 | cwd: 'wpsc-components/theme-engine-v2/theming/assets/css', |
||
66 | src: ['*.css', '!*.min.css', '!wpsc-components/theme-engine-v2/theming/assets/css/font-awesome-ie7.css'], |
||
67 | dest: 'wpsc-components/theme-engine-v2/theming/assets/css', |
||
68 | ext: '.min.css' |
||
69 | }] |
||
70 | } |
||
71 | }, |
||
72 | |||
73 | // Check textdomain errors. |
||
74 | checktextdomain: { |
||
75 | options:{ |
||
76 | text_domain: 'wp-e-commerce', |
||
77 | keywords: [ |
||
78 | '__:1,2d', |
||
79 | '_e:1,2d', |
||
80 | '_x:1,2c,3d', |
||
81 | 'esc_html__:1,2d', |
||
82 | 'esc_html_e:1,2d', |
||
83 | 'esc_html_x:1,2c,3d', |
||
84 | 'esc_attr__:1,2d', |
||
85 | 'esc_attr_e:1,2d', |
||
86 | 'esc_attr_x:1,2c,3d', |
||
87 | '_ex:1,2c,3d', |
||
88 | '_n:1,2,4d', |
||
89 | '_nx:1,2,4c,5d', |
||
90 | '_n_noop:1,2,3d', |
||
91 | '_nx_noop:1,2,3c,4d' |
||
92 | ] |
||
93 | }, |
||
94 | files: { |
||
95 | src: [ |
||
96 | '**/*.php', // Include all files |
||
97 | '!node_modules/**', // Exclude node_modules/ |
||
98 | '!tests/**', // Exclude tests/ |
||
99 | '!bin/**', // Exclude bin/ |
||
100 | '!tmp/**' // Exclude tmp/ |
||
101 | ], |
||
102 | expand: true |
||
103 | } |
||
104 | }, |
||
105 | |||
106 | makepot: { |
||
107 | target: { |
||
108 | options: { |
||
109 | domainPath: '/wpsc-languages/', // Where to save the POT file. |
||
110 | exclude: [ |
||
111 | 'tesst/.*', |
||
112 | 'bin/.*', |
||
113 | 'images/.*' |
||
114 | ], |
||
115 | mainFile: 'wp-shopping-cart.php', // Main project file. |
||
116 | potFilename: 'wp-e-commerce.pot', // Name of the POT file. |
||
117 | potHeaders: { |
||
118 | poedit: true, // Includes common Poedit headers. |
||
119 | 'x-poedit-keywordslist': true // Include a list of all possible gettext functions. |
||
120 | }, |
||
121 | type: 'wp-plugin', // Type of project (wp-plugin or wp-theme). |
||
122 | updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes. |
||
123 | processPot: function( pot ) { |
||
124 | pot.headers['report-msgid-bugs-to'] = 'https://wpecommerce.org/'; |
||
125 | pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)'; |
||
126 | pot.headers['language-team'] = 'WP-Translations <[email protected]>'; |
||
127 | pot.headers['language'] = 'en_US'; |
||
0 ignored issues
–
show
|
|||
128 | return pot; |
||
129 | } |
||
130 | } |
||
131 | } |
||
132 | }, |
||
133 | watch: { |
||
134 | css: { |
||
135 | files: ['wpsc-components/theme-engine-v2/theming/assets/scss/**/*.scss'], |
||
136 | tasks: ['css'], |
||
137 | options: { |
||
138 | spawn: false, |
||
0 ignored issues
–
show
|
|||
139 | }, |
||
0 ignored issues
–
show
|
|||
140 | }, |
||
141 | js: { |
||
142 | files: ['<%= jshint.plugin %>'], |
||
143 | tasks: ['jshint'] |
||
144 | } |
||
145 | } |
||
146 | |||
147 | }); |
||
148 | |||
149 | grunt.registerTask('css', ['sass', 'cmq', 'cssmin']); |
||
150 | grunt.registerTask('default', ['jshint', 'css', 'makepot']); |
||
151 | |||
152 | /** |
||
153 | * PHP Code Sniffer using WordPress Coding Standards. |
||
154 | * |
||
155 | * @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards |
||
156 | */ |
||
157 | grunt.registerTask('phpcs', function() { |
||
158 | var done = this.async(); |
||
159 | |||
160 | grunt.util.spawn({ |
||
161 | cmd: 'phpcs', |
||
162 | args: [ |
||
163 | '-p', |
||
164 | '-s', |
||
165 | '--standard=WordPress', |
||
166 | '--extensions=php', |
||
167 | '--ignore=*/node_modules/*,*/tests/*', |
||
168 | '--report-file=codesniffs.txt', |
||
169 | '.' |
||
170 | ], |
||
171 | opts: { stdio: 'inherit' } |
||
172 | }, done); |
||
173 | }); |
||
174 | |||
175 | }; |
||
176 |