我正在尝试用我的小php代码做一些基本的静态分析。我想使用: phploc phpcpd phpcs
我的项目文件夹结构如下:
.
|-- ci
| `-- docker_install.sh
|-- css
| `-- css.css
|-- index.php
|-- js
| |-- icons.json
| `-- script.js
`-- process.php我用以下代码创建了shell脚本docker_install.sh:
# Install git (the php image doesn't have it) and other tools
apt-get update -yqq
apt-get install git phploc phpcpd phpmd php-pear -yqq
#install composer
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer 和我的构建文件:
image: php:7.0
before_script:
#insatll needed packeges
- bash ci/docker_install.sh > /dev/null
test:app:
script:
#Static analysis
- phploc .
#phpmd check coding style
- phpmd . text naming
#checking Coding Standards with PHP Code Sniffer
- phpcpd .
#Viewing Coding Standards Violations
- phpcs --standard=PEAR --report=summaryy带有以下错误的构建文件:
....
$ phpcpd .
Warning: require_once(Symfony/Component/ClassLoader/ClassLoader.php): failed to open stream: No such file or directory in /usr/share/php/SebastianBergmann/PHPCPD/autoload.php on line 2
Fatal error: require_once(): Failed opening required 'Symfony/Component/ClassLoader/ClassLoader.php' (include_path='.:/usr/local/lib/php') in /usr/share/php/SebastianBergmann/PHPCPD/autoload.php on line 2
ERROR: Build failed: exit code 1我的问题:如何增强这一点,以及如何使其发挥作用?
谢谢!
发布于 2017-02-27 20:01:53
您安装了composer,但从未运行过composer install。只需将其添加到docker_install.sh文件的末尾即可。
https://stackoverflow.com/questions/42473436
复制相似问题