Skip to content

Commit

Permalink
Update tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Feb 16, 2023
1 parent 14c30b5 commit df9a58f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 28 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ _: list
# Config

PHPCS_CONFIG=tools/phpcs.xml
PHPSTAN_SRC_CONFIG=tools/phpstan.src.neon
PHPSTAN_TESTS_CONFIG=tools/phpstan.tests.neon
PHPSTAN_CONFIG=tools/phpstan.neon
PHPSTAN_BASELINE_CONFIG=tools/phpstan.baseline.neon
PHPUNIT_CONFIG=tools/phpunit.xml
INFECTION_CONFIG=tools/infection.json

Expand All @@ -23,8 +23,10 @@ csf: ## Fix PHP files coding style

phpstan: ## Analyse code with PHPStan
mkdir -p var/tools
$(PRE_PHP) "vendor/bin/phpstan" analyse src -c $(PHPSTAN_SRC_CONFIG) $(ARGS)
$(PRE_PHP) "vendor/bin/phpstan" analyse tests -c $(PHPSTAN_TESTS_CONFIG) $(ARGS)
$(PRE_PHP) "vendor/bin/phpstan" analyse src tests -c $(PHPSTAN_CONFIG) $(ARGS)

phpstan-baseline: ## Add PHPStan errors to baseline
make phpstan ARGS="-b $(PHPSTAN_BASELINE_CONFIG)"

# Tests

Expand All @@ -36,15 +38,15 @@ coverage-clover: ## Generate code coverage in XML format
$(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-clover=var/coverage/clover.xml $(ARGS)

coverage-html: ## Generate code coverage in HTML format
$(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-html=var/coverage/coverage-html $(ARGS)
$(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-html=var/coverage/html $(ARGS)

mutations: ## Check code for mutants
make mutations-tests
make mutations-infection

mutations-tests:
mkdir -p var/coverage
$(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-xml=var/coverage/coverage-xml --log-junit=var/coverage/junit.xml
$(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-xml=var/coverage/xml --log-junit=var/coverage/junit.xml

mutations-infection:
$(PRE_PHP) vendor/bin/infection \
Expand All @@ -68,4 +70,4 @@ PRE_PHP=XDEBUG_MODE=off
PHPUNIT_COMMAND="vendor/bin/paratest" -c $(PHPUNIT_CONFIG) --runner=WrapperRunner -p$(LOGICAL_CORES)
PHPUNIT_COVERAGE=php -d pcov.enabled=1 -d pcov.directory=./src $(PHPUNIT_COMMAND)

LOGICAL_CORES=$(shell nproc || sysctl -n hw.logicalcpu || echo 4)
LOGICAL_CORES=$(shell nproc || sysctl -n hw.logicalcpu || wmic cpu get NumberOfLogicalProcessors || echo 4)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</p>

<p align="center">
<a href="https://github.com/orisai/monolog-logtail/actions?query=workflow%3Aci">
<img src="https://github.com/orisai/monolog-logtail/workflows/ci/badge.svg">
<a href="https://github.com/orisai/monolog-logtail/actions?query=workflow%3ACI">
<img src="https://github.com/orisai/monolog-logtail/workflows/CI/badge.svg">
</a>
<a href="https://coveralls.io/r/orisai/monolog-logtail">
<img src="https://badgen.net/coveralls/c/github/orisai/monolog-logtail/v1.x?cache=300">
Expand Down
6 changes: 6 additions & 0 deletions tools/phpstan.baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with true will always evaluate to true\\.$#"
count: 1
path: ../tests/Unit/LogtailHandlerTest.php
7 changes: 7 additions & 0 deletions tools/phpstan.base.neon → tools/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
includes:
- ../vendor/phpstan/phpstan/conf/bleedingEdge.neon
- phpstan.baseline.neon

parameters:
phpVersion: 80100
level: 8
tmpDir: ../var/tools/PHPStan
resultCachePath: %currentWorkingDirectory%/var/tools/PHPStan/resultCache.php

checkBenevolentUnionTypes: true
checkMissingCallableSignature: true
Expand All @@ -16,3 +19,7 @@ parameters:
tooWideThrowType: true
checkedExceptionClasses:
- Orisai\Exceptions\Check\CheckedException

ignoreErrors:
# Monolog V2 and V3 compatibility
- '#^Fetching deprecated class constant (.+) of class Monolog\\Logger(.+)#'
10 changes: 0 additions & 10 deletions tools/phpstan.src.neon

This file was deleted.

9 changes: 0 additions & 9 deletions tools/phpstan.tests.neon

This file was deleted.

0 comments on commit df9a58f

Please sign in to comment.