Skip to content

Commit

Permalink
Merge pull request #52 from OskarStark/feature/makefile
Browse files Browse the repository at this point in the history
Use `symfony` binary and update `CONTRIBUTION.md`
  • Loading branch information
slunak authored Aug 27, 2024
2 parents b26ad54 + 2803521 commit 60f1ee4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
Contributions are very welcome. If you would like to add functionality, before starting your work,
please open an issue to discuss the feature you would like to work on.

All development tools can be executed via `make` commands.
All those commands ensure, you use the correct PHP version and the dependencies.
To achieve this, the commands use the [Symfony CLI](https://github.com/symfony-cli/symfony-cli), so please make sure you have it installed.

#### Coding standards

Check coding standards with [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).

```
php-cs-fixer fix src
make cs
```

#### Code Documentation
Expand All @@ -17,10 +21,10 @@ Document your code with [phpDocumentor](https://github.com/phpDocumentor/phpDocu

#### Static Analysis

Analyze your code with [PHPStan](https://github.com/phpstan/phpstan) and make sure there are no errors except for `buildCurlPostFields` method.
Analyze your code with [PHPStan](https://github.com/phpstan/phpstan).

```
phpstan analyse src --level 5
make static-code-analysis
```

#### Test
Expand Down
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: check-symfony
check-symfony: ## Checks if the symfony binary is installed
@command -v symfony >/dev/null 2>&1 || { echo >&2 "Symfony binary is not installed. Please install it first. https://github.com/symfony-cli/symfony-cli"; exit 1; }

.PHONY: cs
cs: vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer
composer normalize
cs: check-symfony vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer
symfony composer normalize
mkdir -p .build/php-cs-fixer
php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --verbose
symfony php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --verbose

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
php vendor/bin/phpstan analyse --configuration=phpstan-default.neon.dist --memory-limit=-1
static-code-analysis: check-symfony vendor ## Runs a static code analysis with phpstan/phpstan
symfony php vendor/bin/phpstan analyse --configuration=phpstan-default.neon.dist --memory-limit=-1

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan
php vendor/bin/phpstan analyze --configuration=phpstan-default.neon.dist --generate-baseline=phpstan-default-baseline.neon --memory-limit=-1
static-code-analysis-baseline: check-symfony vendor ## Generates a baseline for static code analysis with phpstan/phpstan
symfony php vendor/bin/phpstan analyze --configuration=phpstan-default.neon.dist --generate-baseline=phpstan-default-baseline.neon --memory-limit=-1

.PHONY: tests
tests: check-symfony vendor
symfony php vendor/bin/phpunit tests

.PHONY: vendor
vendor: composer.json composer.lock ## Installs composer dependencies
symfony composer install

0 comments on commit 60f1ee4

Please sign in to comment.