Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for infection and psalm #386

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: fix-encoding-pragma
args: ['--maxkb=600']

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
Expand Down
55 changes: 46 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,43 @@ lint-stan:
$(APP_COMPOSER) stan
.PHONY: lint-stan

lint-stan-ci: ## Runs phpstan – static analysis tool with github output (CI mode)
$(APP_COMPOSER) stan:ci
.PHONY: lint-stan-ci

lint-stan-baseline: ## Runs phpstan to update its baseline
$(APP_COMPOSER) stan:baseline
.PHONY: lint-stan-baseline

lint-psalm: ## Runs vimeo/psalm – static analysis tool
$(APP_COMPOSER) psalm
.PHONY: lint-psalm

lint-psalm-ci: ## Runs vimeo/psalm – static analysis tool with github output (CI mode)
$(APP_COMPOSER) psalm:ci
.PHONY: lint-psalm-ci

lint-psalm-baseline: ## Runs vimeo/psalm to update its baseline
$(APP_COMPOSER) psalm:baseline
.PHONY: lint-psalm-baseline

lint-deps: ## Runs composer-require-checker – checks for dependencies that are not used
$(APP_RUNNER) .phive/composer-require-checker check \
--config-file=/app/composer-require-checker.json \
--verbose
.PHONY: lint-deps

lint-ddd-deps:
$(APP_RUNNER) .phive/deptrac
.PHONY: lint-ddd-deps
lint-deptrac: ## Runs deptrac – static analysis tool
$(APP_RUNNER) .phive/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache
.PHONY: lint-deptrac

lint-deptrac-ci: ## Runs deptrac – static analysis tool with github output (CI mode)
$(APP_RUNNER) .phive/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter github-actions
.PHONY: lint-deptrac-ci

lint-deptrac-gv: ## Runs deptrac – static analysis tool and generates graphviz image
$(APP_RUNNER) .phive/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter graphviz-image --output ../assets/deptrac.svg
.PHONY: lint-deptrac-gv

lint-composer: ## Normalize composer.json and composer.lock files
$(APP_RUNNER) .phive/composer-normalize normalize
Expand All @@ -273,6 +297,14 @@ lint-audit: ## Runs security checks for composer dependencies
#
# Testing
# ------------------------------------------------------------------------------------
infect: ## Runs mutation tests with infection/infection
$(APP_COMPOSER) infect
.PHONY: infect

infect-ci: ## Runs infection – mutation testing framework with github output (CI mode)
$(APP_COMPOSER) infect:ci
.PHONY: lint-infect-ci

test: ## Run project php-unit and pest tests
$(APP_COMPOSER) test
.PHONY: test
Expand All @@ -281,14 +313,15 @@ test-cc: ## Run project php-unit and pest tests in coverage mode and build repor
$(APP_COMPOSER) test:cc
.PHONY: test-cc

api-docs: ## Generate openapi docs specification file
$(APP_EXEC) php artisan open-docs:generate
.PHONY: api-docs



api-docs-public: ## Generate openapi docs specification file for public api
$(APP_EXEC) php artisan open-docs:generate public
.PHONY: api-docs-public

api-docs-admin: ## Generate openapi docs specification file for admin api
$(APP_EXEC) php artisan open-docs:generate admin
.PHONY: api-docs-admin

#
# Database Commands
# ------------------------------------------------------------------------------------
db-wipe: ## Wipe database
Expand All @@ -299,7 +332,11 @@ db-refresh: ## Delete migration files, wipe database, create new migrations, run
$(APP_EXEC) php artisan migrate:fresh
.PHONY: db-refresh

db-migrate: ## Run all pending migrations
$(APP_EXEC) php artisan migrate
.PHONY: db-migrate

#
# Deployer Commands
# ------------------------------------------------------------------------------------
dep-staging:
Expand Down
52 changes: 47 additions & 5 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
"license": "MIT",
"type": "project",
"keywords": [
"framework",
"laravel"
"php",
"laravel",
"boilerplate",
"laravel-boilerplate",
"starter-template",
"laravel-package",
"starter-kit",
"laravel-application",
"starter-project",
"laravel-starter-template",
"laravel-starter-kit",
"laravel-api",
"laravel-ddd",
"ddd"
],
"require": {
"php": "^8.2",
Expand All @@ -17,20 +29,29 @@
"league/fractal": "^0.20.1",
"sentry/sentry-laravel": "^4.5",
"spatie/laravel-fractal": "^6.2",
"spatie/laravel-query-builder": "^5.8",
"spatie/laravel-query-builder": "^6.0",
"spatie/laravel-route-attributes": "^1.22",
"wayofdev/laravel-open-docs": "^2.1"
},
"require-dev": {
"ergebnis/phpunit-slow-test-detector": "^2.14",
"fakerphp/faker": "^1.23",
"larastan/larastan": "^2.9",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-laravel": "^2.4",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "^10.5",
"psalm/plugin-laravel": "^2.11",
"psalm/plugin-phpunit": "~0.19.0",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/laravel-ignition": "^2.7",
"vimeo/psalm": "^5.23.1",
"wayofdev/cs-fixer-config": "^1.4"
},
"minimum-stability": "dev",
Expand All @@ -52,6 +73,7 @@
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"pestphp/pest-plugin": true,
"php-http/discovery": true,
"phpstan/extension-installer": true
Expand Down Expand Up @@ -88,9 +110,29 @@
"deptrac": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache",
"deptrac:ci": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter github-actions",
"deptrac:gv": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter graphviz-image --output ../assets/deptrac.svg",
"infect": [
"Composer\\Config::disableProcessTimeout",
"@putenv XDEBUG_MODE=coverage",
"php -d memory_limit=2G vendor/bin/roave-infection-static-analysis-plugin --threads=2"
],
"infect:ci": [
"Composer\\Config::disableProcessTimeout",
"@putenv XDEBUG_MODE=coverage",
"php -d memory_limit=2G vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ansi --logger-github --ignore-msi-with-no-mutations --only-covered"
],
"psalm": "php vendor/bin/psalm --show-info=true",
"psalm:baseline": "php vendor/bin/psalm --set-baseline=psalm-baseline.xml",
"psalm:ci": "php vendor/bin/psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
"stan": "php vendor/bin/phpstan analyse --memory-limit=2G",
"stan:baseline": "php vendor/bin/phpstan analyse --generate-baseline --memory-limit=2G --allow-empty-baseline",
"test": "php vendor/bin/pest",
"test:cc": "XDEBUG_MODE=coverage php vendor/bin/pest --coverage-clover coverage.xml"
"stan:ci": "php vendor/bin/phpstan analyse --memory-limit=2G --error-format=github",
"test": [
"@putenv XDEBUG_MODE=coverage",
"php vendor/bin/pest --color=always"
],
"test:cc": [
"@putenv XDEBUG_MODE=coverage",
"php vendor/bin/pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml --color=always"
]
}
}
Loading