承接 vansari/phplint-merger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vansari/phplint-merger

Composer 安装命令:

composer create-project vansari/phplint-merger

包简介

Simple XML Log Merger for overtrue/phplint xml reports

README 文档

README

Simple XML Merger for overtrue/phplint xml reports

Gihub Latest Stable Version License codecov

Description

This package is inspired from the Repository PHPUnit-Merger.
The merger can be used to combine many xml results from the phplint Repo.

We are using the overtrue/phplint package for static analyze. overtrue/phplint is a fast tool with flexible configuration via yaml. It generates one testsuite (PHP Linter) with a big testcase with all errors. But sometimes it is not necessary to analyze all files again and again.

For us it was necessary to lint only files which are new or modified by the developer. In our CI we run the lint against this files.

vendor/bin/phplint ./this/is/new/File.php -c .phplint.xml --xml=build/phplint/lint-result-File.xml

If you try to merge this file with another lint result file it will be not possible.

Here is the benfit of this new package:

The script sorts the results from one testcase with many classes to one testcase per class with the related errors.
The testsuite will have an overall result of the tests and errors.

The testcases will have an overall result of the errors.

Install

composer install vansari/phplint-merger

Example

File 1

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="PHP Linter" timestamp="2020-12-10T20:35:50+0100" time="1 sec" tests="1" errors="2">
        <testcase errors="2" failures="0">
            <error type="Error" message=" Methods with the same name as their class will not be constructors in line 3">/root/path/of/project/src/folder/subfolder1/Class1.php</error>
            <error type="Error" message=" Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in line 140">/root/path/of/project/src/folder/subfolder1/Class1.php</error>
        </testcase>
    </testsuite>
</testsuites>

File 2

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="PHP Linter" timestamp="2020-12-10T20:35:50+0100" time="1 sec" tests="1" errors="2">
        <testcase errors="2" failures="0">
            <error type="Error" message=" Array and string offset access syntax with curly braces is deprecated in line 91">/root/path/of/project/src/folder/subfolder1/Class2.php</error>
            <error type="Error" message=" Array and string offset access syntax with curly braces is deprecated in line 8">/root/path/of/project/src/folder/subfolder1/Class2.php</error>
        </testcase>
    </testsuite>
</testsuites>

Execute XML Merge

vendor/bin/phplint-merger xml path/to/results path/to/output.xml

Result:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="PHP Linter" tests="2" errors="4">
        <testcase name="/root/path/of/project/src/folder/subfolder1/Class1.php" errors="2" failures="0">
            <error type="Error" message="Methods with the same name as their class will not be constructors in line 3"/>
            <error type="Error" message="Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in line 140"/>
        </testcase>
        <testcase name="/root/path/of/project/src/folder/subfolder1/Class2.php" errors="2" failures="0">
            <error type="Error" message="Array and string offset access syntax with curly braces is deprecated in line 91"/>
            <error type="Error" message="Array and string offset access syntax with curly braces is deprecated in line 8"/>
        </testcase>
    </testsuite>
</testsuites>

统计信息

  • 总下载量: 22.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固