{"id":15014438,"url":"https://github.com/exussum12/coveragechecker","last_synced_at":"2025-05-16T15:02:18.117Z","repository":{"id":15366544,"uuid":"77994733","full_name":"exussum12/coverageChecker","owner":"exussum12","description":"Allows old code to use new standards","archived":false,"fork":false,"pushed_at":"2024-06-25T15:13:32.000Z","size":288,"stargazers_count":177,"open_issues_count":4,"forks_count":18,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-12T11:14:17.795Z","etag":null,"topics":["codeclimate","coverage","diff","filter","hacktoberfest","jacoco","phan","php","phpcs","phpmd","phpstan","phpunit","pylint","qa","quality","quality-control","standalone-php-library","standard-conform","standards","static-code-analysis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exussum12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-04T08:03:27.000Z","updated_at":"2024-06-25T15:05:21.000Z","dependencies_parsed_at":"2024-09-30T08:01:28.826Z","dependency_job_id":"dedca28d-381a-4638-8f83-ad046025e733","html_url":"https://github.com/exussum12/coverageChecker","commit_stats":{"total_commits":233,"total_committers":13,"mean_commits":"17.923076923076923","dds":"0.32618025751072965","last_synced_commit":"0a0350772ca3077d18e87118ffb1d9338b10c63c"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exussum12%2FcoverageChecker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exussum12%2FcoverageChecker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exussum12%2FcoverageChecker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exussum12%2FcoverageChecker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exussum12","download_url":"https://codeload.github.com/exussum12/coverageChecker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557843,"owners_count":21124168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeclimate","coverage","diff","filter","hacktoberfest","jacoco","phan","php","phpcs","phpmd","phpstan","phpunit","pylint","qa","quality","quality-control","standalone-php-library","standard-conform","standards","static-code-analysis"],"created_at":"2024-09-24T19:45:38.223Z","updated_at":"2025-04-12T11:14:24.651Z","avatar_url":"https://github.com/exussum12.png","language":"PHP","readme":"# coverageChecker\nAllows old code to use new standards\n\n[![Build Status](https://travis-ci.org/exussum12/coverageChecker.svg?branch=master)](https://travis-ci.org/exussum12/coverageChecker)\n[![Coverage Status](https://coveralls.io/repos/github/exussum12/coverageChecker/badge.svg?branch=master)](https://coveralls.io/github/exussum12/coverageChecker?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/exussum12/coverageChecker/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/exussum12/coverageChecker/?branch=master)\n\nCoverage checker allows new standards to be implemented incrementally, by only enforcing them on new / edited code.\n\nTools like phpcs and phpmd are an all or nothing approach, coverage checker allows this to work with the diff i.e. enforce all of the pull request / change request.\n\nThis is sometimes called \"Baselining\"\n\nAlso working with PHPunit to allow, for example 90% of new/edited code to be covered. which will increase the overall coverage over time.\n\n# Installing\n\n## Composer\nWith composer simply\n\n    composer require --dev exussum12/coverage-checker\n    \nthen call the script you need\n\n## Using Phar\nPhar is a packaged format which should be a single download. The latest Phar can be found [Here](https://github.com/exussum12/coverageChecker/releases).\n\nAfter downloading run `chmod +x diffFilter.phar` and then call as `./diffFilter.phar` followed by the normal options\n\n## Manually\nClone this repository somewhere your your build plan can be accessed, composer install is preferred but there is a non composer class loader which will be used if composer is not installed. If composer is not used some PHP specific features will not work as expected.\nThen call the script you need\n\n\n# Usage\n\nFirst of all a diff is needed \n\n    git diff origin/master... \u003e diff.txt\n     \nSee [here](https://github.com/exussum12/coverageChecker/wiki/Generating-a-diff) for a more in depth examples of what diff you should generate\n\nThen the output for the tool you wish to check (such as phpcs, PHPUnit, phpmd etc) for example\n\n     phpcs --standard=psr2 --report=json \u003e phpcs.json || true \n     \nHere the `|| true` ensures that the whole build will not fail if phpcs fails.\n\nThen call diffFilter\n\n     ./vendor/bin/diffFilter --phpcs diff.txt phpcs.json 100\n\nThe last argument (100 in this case) is optional, the default is 100. This can be lowered to 90 for example to ensure that at least 90% of the changed code conforms to the standard.\ndiffFilter will exit with a `0` status if the changed code passes the minimum coverage. `2` otherwise\n\n## Extended guide\nA more in depth guide can be [found on the wiki](https://github.com/exussum12/coverageChecker/wiki) also some tips for speeding up the build.\n\n## Installing as a git hook\n\nThere are 2 examples hooks in the GitHooks directory, if you symlink to these diffFilter will run locally.\n\npre-commit is before the commit happens\npre-receive will prevent you pushing\n\n# Full list of available diff filters\n\nBelow is a list of all tools and a brief description\n\n```\n--buddy\t\tParses buddy (magic number detection) output\n--checkstyle\tParses a report in checkstyle format\n--clover\tParses text output in clover (xml) format\n--codeclimate\tParse codeclimate output\n--humbug\tParses the json report format of humbug (mutation testing)\n--infecton\tParses the infection text log format\n--jacoco\tParses xml coverage report produced by Jacoco\n--phan\t\tParse the default phan(static analysis) output\n--phanJson\tParses phan (static analysis) in json format\n--phpcpd\tParses the text output from phpcpd (Copy Paste Detect)\n--phpcs\t\tParses the json report format of phpcs, this mode only reports errors as violations\n--phpcsStrict\tParses the json report format of phpcs, this mode reports errors and warnings as violations\n--phpmd\t\tParses the xml report format of phpmd, this mode reports multi line violations once per diff, instead of on each line\n\t\tthe violation occurs\n--phpmdStrict\tParses the xml report format of phpmd, this mode reports multi line violations once per line they occur \n--phpmnd\tParses the text output of phpmnd (Magic Number Detection)\n--phpstan\tParses the text output of phpstan\n--phpunit\tParses text output in clover (xml) format generated with coverage-clover=file.xml\n--pylint\tParses PyLint output\n--psalm\t\tParses Psalm output\n```\n\n\n# Running in information mode\nSimply pass the 3rd argument in as 0, this will give output showing failed lines but will not fail the build\n\n\n# Why not run the auto fixers\nAuto fixers do exist for some of these tools, but on larger code bases there are many instances where these can not be auto fixed. CoverageChecker allows to go to these new standards in the most used parts of the code by enforcing all changes to comply to the new standards\n\n# What is a diff filtered test\n\nA diff filtered test is a test where the execution and diffence (diff) is used from a known point.\nThis information can be used to only run the tests which have been changed. Saving in many cases minutes running tests.\n\nA good workflow is to branch, run the tests with `--coverage-php=php-coverage.php`  and then when running your tests run `git diff origin/master... \u003e diff.txt \u0026\u0026 ./composer/bin/phpunit`\n\nThis saves the coverage information in the first step which the diff then filters to runnable tests.\n\nThis one time effort saves running unnecessary tests on each run, tests for which the code has not changed.\n\nCheck the [Wiki](https://github.com/exussum12/coverageChecker/wiki/PHPUnit-or-Clover#speeding-up-builds-with-phpunit) for more information on installation and usage\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexussum12%2Fcoveragechecker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexussum12%2Fcoveragechecker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexussum12%2Fcoveragechecker/lists"}