File tree Expand file tree Collapse file tree 7 files changed +65
-77
lines changed Expand file tree Collapse file tree 7 files changed +65
-77
lines changed Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ indent_style = space
5+ indent_size = 4
6+ end_of_line = lf
7+ charset = utf-8
8+ trim_trailing_whitespace = true
9+ insert_final_newline = true
10+
11+ [Makefile ]
12+ indent_style = tab
Original file line number Diff line number Diff line change 11/vendor /
22.idea
3+ composer.lock
Original file line number Diff line number Diff line change 1+ ARG PHP_VERSION=8.2
2+ FROM php:$PHP_VERSION-cli-alpine
3+
4+ RUN apk add git
5+
6+ COPY --from=composer /usr/bin/composer /usr/bin/composer
7+
Original file line number Diff line number Diff line change 1- PHP_BIN =php
2- COMPOSER_BIN =$(PHP_BIN ) composer.phar
1+ PHP_IMAGE_TAG =flyeralarm/php-code-valiator-cli:$(PHP_VERSION )
2+ PHP_VERSION? =8.2
3+
4+ PHP_BIN =$(RUNNER ) php
5+ COMPOSER_BIN =$(RUNNER ) /usr/bin/composer
6+
7+ RUNNER =docker run --init -it --rm -v "$(PWD ) :/app" -w /app $(PHP_IMAGE_TAG )
8+
39
410# ---------------------------------------------
511
612# make
713.DEFAULT_GOAL := install
814
15+ .PHONY : build
16+ build :
17+ docker image build --tag $(PHP_IMAGE_TAG ) --build-arg PHP_VERSION=$(PHP_VERSION ) .
18+ $(RUNNER ) sh -c " php --version && which composer && composer --version"
19+
20+ .PHONY : install
921install :
1022 $(COMPOSER_BIN ) install
1123
24+ .PHONY : update
25+ update :
26+ rm -rf vendor/ composer.lock
27+ $(COMPOSER_BIN ) update
28+
29+ .PHONY : sniff
1230sniff :
1331 $(PHP_BIN ) vendor/bin/phpcs -w -p -s --standard=ruleset.xml --ignore=" tests/*not-allowed*" custom-standards/ tests/
1432
33+ .PHONY : sniff-fix
1534sniff-fix :
1635 $(PHP_BIN ) vendor/bin/phpcbf -w -p -s --standard=ruleset.xml --ignore=" tests/*not-allowed*" custom-standards/ tests/
1736
37+ .PHONY : test
1838test :
1939 $(PHP_BIN ) tests/runner.php
40+
41+ .PHONY : test-all
42+ test-all :
43+ PHP_VERSION=8.2 $(MAKE ) build update sniff test
44+ PHP_VERSION=8.1 $(MAKE ) build update sniff test
45+ PHP_VERSION=7.4 $(MAKE ) build update sniff test
46+ PHP_VERSION=7.3 $(MAKE ) build update sniff test
Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ To test ruleset run command:
3737make test
3838```
3939
40+ As test runner is dockerized we can test with different PHP versions:
41+ ``` shell
42+ PHP_VERSION=8.2 make test
43+ ```
44+
45+ or all at once:
46+ ``` shell
47+ make test-all
48+ ```
49+
4050
4151## Embed into * your* project
4252
5363 vendor/bin/phpcs -w -p -s --standard=vendor/flyeralarm/php-code-validator/ruleset.xml src/ tests/
5464```
5565
66+ or in shorter version by using code validator binary which already use flyeralarm as default standard :
67+ ```make
68+ test :
69+ vendor/bin/php-code-validator src/ tests/
70+ ```
71+
5672
5773### Add project specific rules
5874
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments