diff --git a/.gitignore b/.gitignore index cff834966..51e3be2ba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,9 @@ phpunit.xml box.json deptrac.version junit-report.xml -.php-cs-fixer.cache .php-cs-fixer.php -.deptrac.cache -.phpunit.result.cache infection.log +.cache/ # downgrade with Rector /rector-local diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index a73ded8f6..f2743abf5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,6 +7,7 @@ return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) + ->setCacheFile('./.cache/php-cs-fixer.cache') ->setRules([ '@Symfony' => true, 'array_syntax' => ['syntax' => 'short'], diff --git a/Makefile b/Makefile index b812b77bb..545730b4e 100644 --- a/Makefile +++ b/Makefile @@ -18,11 +18,11 @@ build: tests ## Runs tests and creates the phar-binary .PHONY: composer-install composer-install: ## Installs dependencies - $(COMPOSER_BIN) install --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi + $(COMPOSER_BIN) install --no-interaction --no-progress --optimize-autoloader --ansi .PHONY: deptrac deptrac: ## Analyses own architecture using the default config confile - $(PHP_BIN) deptrac.php --config-file=deptrac.config.php analyse --no-progress --ansi + $(PHP_BIN) deptrac.php --config-file=deptrac.config.php --cache-file=./.cache/deptrac.cache --no-progress --ansi #generate-changelog: ## Generates a changelog file based on changes compared to remote origin # gem install github_changelog_generator @@ -35,7 +35,7 @@ gpg: ## Signs release with default GPG key "4AB1782E" .PHONY: infection infection: composer-install ## Runs mutation tests - $(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=85 --psalm-config=psalm.xml + $(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=85 --psalm-config=psalm.xml .PHONY: php-cs-check php-cs-check: ## Checks for code style violation @@ -55,7 +55,7 @@ psalm: ## Performs static code analysis using psalm .PHONY: tests-coverage tests-coverage: composer-install ## Runs tests and generate an html coverage report - $(PHPUNIT_BIN) -c . --coverage-html coverage + XDEBUG_MODE=coverage $(PHPUNIT_BIN) -c . --coverage-html coverage .PHONY: tests tests: composer-install ## Runs tests followed by a very basic e2e-test diff --git a/deptrac.baseline.yaml b/deptrac.baseline.yaml new file mode 100644 index 000000000..c37736d17 --- /dev/null +++ b/deptrac.baseline.yaml @@ -0,0 +1,4 @@ +deptrac: + skip_violations: + ClassA: + - ClassB diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..348f3486f --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +version: '3.8' + +services: + deptrac: + build: + dockerfile: docker/php/Dockerfile + context: ./ + container_name: deptrac + tty: true + user: "${USER_ID:-1000}:${GROUP_ID:-1000}" + working_dir: /var/www/deptrac + volumes: + - ./:/var/www/deptrac + extra_hosts: + - host.docker.internal:${HOST_IP:-172.17.0.1} + diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 000000000..d5962685d --- /dev/null +++ b/docker/php/Dockerfile @@ -0,0 +1,9 @@ +FROM php:8.1-cli +RUN apt-get update && apt-get install -y git zip && apt-get clean +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug \ + && pecl clear-cache \ + +WORKDIR /var/www/deptrac +COPY --from=composer /usr/bin/composer /usr/bin/composer + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 82b618e49..e0201ac68 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -11,6 +11,7 @@ parameters: checkMissingCallableSignature: true level: max paths: [src] + tmpDir: ./.cache/phpstan stubFiles: - internal/stubs/Function_.php - internal/stubs/ClassLike.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b0ddde415..2179a7b46 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,13 +6,16 @@ colors="true" executionOrder="random" resolveDependencies="true" + cacheResultFile=".cache/phpunit/phpunit.result.cache" > ./tests/ - + ./src diff --git a/psalm.xml b/psalm.xml index 8516e1bff..57e2f66df 100644 --- a/psalm.xml +++ b/psalm.xml @@ -8,6 +8,7 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="baseline.xml" + cacheDirectory="./.cache/psalm" >