【发布时间】:2015-05-19 14:14:23
【问题描述】:
我最近开始使用 grunt 来帮助自动化一些编码任务。我真的很想实现 phpcs(PHP 代码嗅探器)模块,但我在尝试让它工作时遇到了错误。
我的开发工作站是 Windows 7 64 位操作系统。我安装了 Node.js 以及 Grunt 和 Grunt CLI。
这是我的 grunt 文件中的 phpcs 配置。
phpcs: {
theme: {
src: '**/*.*'
},
options: {
bin: "vendor/bin/phpcs --extensions=php ",
standard: "WordPress-Core"
}
},
watch: {
scripts: {
files: '**/*.js',
tasks: ['jshint'],
},
php: {
files: '**/*.php',
tasks: ['phpcs'],
},
css: {
files: '**/*.css',
},
lr: {
options: {
livereload: true
},
files: ['**/*.js', '**/*.php', '**/*.css'],
}
},
});
当我运行 grunt 然后更改一个 php 文件时,我得到以下内容
Running "watch" task
Waiting...
>> File "header.php" changed.
Running "phpcs:theme" (phpcs) task
Warning: spawn ENAMETOOLONG Use --force to continue.
Aborted due to warnings.
Completed in 2.422s at Tue May 19 2015 09:57:21 GMT-0400 (Eastern Daylight Time)
- Waiting...
我尝试使用 fenestrate 来缩短路径,但这没有帮助。我将我的项目目录从我的 dev wordpress 安装中移出并靠近我的驱动器的根目录,但即使使用 fenestrate 也无济于事。
我不确定 ENAMETOOLONG 警告所抱怨的路径是什么。我真的很想让这项工作来帮助改进我的代码。
任何建议或帮助将不胜感激。
【问题讨论】:
-
看起来可能与 PHP_CodingSniffer 未完全安装有关。我无法获得已安装编码标准的列表。它从不将任何内容打印到屏幕上,我只是返回命令提示符。
标签: javascript node.js wordpress gruntjs