首页 > 解决方案 > Makefile:12:目标“lint”的配方失败

问题描述

我正在 GitHub 存储库上发出拉取请求。在进行 PR 之前,我已经使用 PHPUnit 测试了我的代码,并且所有测试都通过了。所以,我在 GitHub 上做了 PR。但是在 travis-ci 检查了我的 PR 之后,我的 PR 没有通过并且错误说:

Makefile:12:目标“lint”的配方失败

我对所有这些错误一无所知。我想如果我的 PHPUnit 测试成功,那么我将通过 travis-ci 检查。但不幸的是没有。

这是我遇到的一些错误

sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
[32mGenerating optimized autoload files[39m
travis_time:end:2e276f14:start=1563869333859320964,finish=1563869405903083472,duration=72043762508
[0Ktravis_fold:end:install
[0Ktravis_time:start:113ef200
[0K$ make lint
php /home/travis/build/cloudflare/cloudflare-php/vendor/bin/php-cs-fixer fix --config=/home/travis/build/cloudflare/cloudflare-php/.php_cs --dry-run
Loaded config [33mdefault[39m from "/home/travis/build/cloudflare/cloudflare-php/.php_cs".
   1) cloudflare-php/src/Endpoints/Zones.php
   2) cloudflare-php/tests/Endpoints/ZonesTest.php

Checked all files in 0.893 seconds, 14.000 MB memory used
Makefile:12: recipe for target 'lint' failed
make: *** [lint] Error 8
travis_time:end:113ef200:start=1563869405907430819,finish=1563869407016751613,duration=1109320794
[0K[31;1mThe command "make lint" exited with 2.[0m

travis_time:start:0ca9e138
[0K$ make test
php /home/travis/build/cloudflare/cloudflare-php/vendor/bin/phpunit --configuration /home/travis/build/cloudflare/cloudflare-php/phpunit.xml
PHPUnit 5.7.5 by Sebastian Bergmann and contributors.

...............................................................  63 / 120 ( 52%)
.........................................................       120 / 120 (100%)

Time: 8.69 seconds, Memory: 10.00MB

OK (120 tests, 720 assertions)
travis_time:end:0ca9e138:start=1563869407021249545,finish=1563869415802590423,duration=8781340878
[0K[32;1mThe command "make test" exited with 0.[0m


Done. Your build exited with 1.

标签: phpphpunittravis-ci

解决方案


CI/CD 管道将为您的构建添加一个抽象层。在本地运行测试,它应该为您输出提示 =)

$ php ./vendor/bin/phpmd tests/ text cleancode,codesize,controversial,design,naming,unusedcode
/Repos/cloudflare-php/tests/Endpoints/ZonesTest.php:9   The class ZonesTest has 11 public methods. Consider refactoring ZonesTest to keep number of public methods under 10.

推荐阅读