Download the PHP package exussum12/coverage-checker without Composer

On this page you can find all versions of the php package exussum12/coverage-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package coverage-checker

coverageChecker

Allows old code to use new standards

Build Status Coverage Status Scrutinizer Code Quality

Coverage checker allows new standards to be implemented incrementally, by only enforcing them on new / edited code.

Tools 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.

This is sometimes called "Baselining"

Also working with PHPunit to allow, for example 90% of new/edited code to be covered. which will increase the overall coverage over time.

Installing

Composer

With composer simply

composer require --dev exussum12/coverage-checker

then call the script you need

Using Phar

Phar is a packaged format which should be a single download. The latest Phar can be found Here.

After downloading run chmod +x diffFilter.phar and then call as ./diffFilter.phar followed by the normal options

Manually

Clone 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. Then call the script you need

Usage

First of all a diff is needed

git diff origin/master... > diff.txt

See here for a more in depth examples of what diff you should generate

Then the output for the tool you wish to check (such as phpcs, PHPUnit, phpmd etc) for example

 phpcs --standard=psr2 --report=json > phpcs.json || true 

Here the || true ensures that the whole build will not fail if phpcs fails.

Then call diffFilter

 ./vendor/bin/diffFilter --phpcs diff.txt phpcs.json 100

The 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. diffFilter will exit with a 0 status if the changed code passes the minimum coverage. 2 otherwise

Extended guide

A more in depth guide can be found on the wiki also some tips for speeding up the build.

Installing as a git hook

There are 2 examples hooks in the GitHooks directory, if you symlink to these diffFilter will run locally.

pre-commit is before the commit happens pre-receive will prevent you pushing

Full list of available diff filters

Below is a list of all tools and a brief description

Running in information mode

Simply pass the 3rd argument in as 0, this will give output showing failed lines but will not fail the build

Why not run the auto fixers

Auto 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

What is a diff filtered test

A diff filtered test is a test where the execution and diffence (diff) is used from a known point. This information can be used to only run the tests which have been changed. Saving in many cases minutes running tests.

A 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... > diff.txt && ./composer/bin/phpunit

This saves the coverage information in the first step which the diff then filters to runnable tests.

This one time effort saves running unnecessary tests on each run, tests for which the code has not changed.

Check the Wiki for more information on installation and usage


All versions of coverage-checker with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-xmlreader Version *
ext-json Version *
nikic/php-parser Version ^3.1||^4.0||^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package exussum12/coverage-checker contains the following files

Loading the files please wait ....