1- # Author: Dominik Harmim <harmim6@gmail.com>
2-
31FIX := 0
42CI := 0
53
@@ -14,6 +12,10 @@ CODE_CHECKER := nette/code-checker
1412CODE_CHECKER_VERSION := ~3.3.0
1513CODE_CHECKER_DIR := $(TEMP_DIR ) /code-checker
1614
15+ CODING_STANDARD := nette/coding-standard
16+ CODING_STANDARD_VERSION := ~3.3.2
17+ CODING_STANDARD_DIR := $(TEMP_DIR ) /coding-standard
18+
1719COVERALLS := php-coveralls/php-coveralls
1820COVERALLS_VERSION := ^2.5
1921COVERALLS_DIR := $(TEMP_DIR ) /coveralls
@@ -33,55 +35,78 @@ composer: docker-compose-php
3335 $(DOCKER_PHP ) composer install --no-interaction --no-progress
3436
3537
36- .PHONY : code-checker
37- code-checker : code-checker-install code-checker-run
38-
3938.PHONY : code-checker-install
4039code-checker-install : docker-compose-php
4140ifeq ($(wildcard $(CODE_CHECKER_DIR ) /.) , )
42- $(DOCKER_PHP) composer create-project $(CODE_CHECKER) $(CODE_CHECKER_DIR) $(CODE_CHECKER_VERSION) --no-interaction \
41+ $(DOCKER_PHP) composer create-project $(CODE_CHECKER) $(CODE_CHECKER_DIR) \
42+ $(CODE_CHECKER_VERSION) --no-interaction --no-progress --no-dev
43+ endif
44+
45+ .PHONY : code-checker
46+ code-checker : code-checker-install docker-compose-php
47+ ifeq ($(FIX ) , 0)
48+ $(DOCKER_PHP) ./$(CODE_CHECKER_DIR)/code-checker --no-progress \
49+ --strict-types --eol
50+ else
51+ $(DOCKER_PHP) ./$(CODE_CHECKER_DIR)/code-checker --no-progress \
52+ --strict-types --eol --fix
53+ endif
54+
55+
56+ .PHONY : coding-standard-install
57+ coding-standard-install : docker-compose-php
58+ ifeq ($(wildcard $(CODING_STANDARD_DIR ) /.) , )
59+ $(DOCKER_PHP) composer create-project $(CODING_STANDARD) \
60+ $(CODING_STANDARD_DIR) $(CODING_STANDARD_VERSION) --no-interaction \
4361 --no-progress --no-dev
4462endif
4563
46- .PHONY : code-checker-run
47- code-checker-run : docker-compose-php
64+ .PHONY : coding-standard
65+ coding-standard : coding-standard-install docker-compose-php
4866ifeq ($(FIX ) , 0)
49- $(DOCKER_PHP) ./$(CODE_CHECKER_DIR)/code-checker --no-progress --strict-types --eol
67+ $(DOCKER_PHP) ./$(CODING_STANDARD_DIR)/ecs check $(SRC_DIR) $(TESTS_DIR)
5068else
51- $(DOCKER_PHP) ./$(CODE_CHECKER_DIR)/code-checker --no-progress --strict-types --eol --fix
69+ $(DOCKER_PHP) ./$(CODING_STANDARD_DIR)/ecs check $(SRC_DIR) $(TESTS_DIR) \
70+ --fix
5271endif
5372
5473
74+ .PHONY : phpstan
75+ phpstan : install docker-compose-php
76+ $(DOCKER_PHP ) ./$(VENDOR_BIN_DIR ) /phpstan analyse -c phpstan.neon \
77+ --no-progress
78+
79+
5580.PHONY : tests
5681tests : install docker-compose-php
5782 $(DOCKER_PHP ) ./$(VENDOR_BIN_DIR ) /tester $(TESTS_DIR ) -s -C
5883
5984
60- .PHONY : tests-coverage
61- tests-coverage : tests-coverage-install tests-coverage-run
62-
6385.PHONY : tests-coverage-install
6486tests-coverage-install : docker-compose-php
6587ifeq ($(wildcard $(COVERALLS_DIR ) /.) , )
66- $(DOCKER_PHP) composer create-project $(COVERALLS) $(COVERALLS_DIR) $(COVERALLS_VERSION) --no-interaction \
67- --no-progress --no-dev
88+ $(DOCKER_PHP) composer create-project $(COVERALLS) $(COVERALLS_DIR) \
89+ $(COVERALLS_VERSION) --no-interaction --no-progress --no-dev
6890endif
6991
70- .PHONY : tests-coverage-run
71- tests-coverage-run : install docker-compose-php
72- $(DOCKER_PHP ) ./$(VENDOR_BIN_DIR ) /tester -p phpdbg $(TESTS_DIR ) -s -C --coverage coverage.xml \
73- --coverage-src $(SRC_DIR )
92+ .PHONY : tests-coverage
93+ tests-coverage : install tests-coverage- install docker-compose-php
94+ $(DOCKER_PHP ) ./$(VENDOR_BIN_DIR ) /tester -p phpdbg $(TESTS_DIR ) -s -C \
95+ --coverage coverage.xml --coverage -src $(SRC_DIR )
7496ifeq ($(CI ) , 1)
7597 $(DOCKER_PHP) git config --global --add safe.directory /app
76- $(DOCKER_PHP) ./$(COVERALLS_DIR)/bin/php-coveralls --verbose --config $(TESTS_DIR)/.coveralls.github-actions.yml
98+ $(DOCKER_PHP) ./$(COVERALLS_DIR)/bin/php-coveralls --verbose \
99+ --config $(TESTS_DIR)/.coveralls.github-actions.yml
77100else
78- $(DOCKER_PHP) ./$(COVERALLS_DIR)/bin/php-coveralls --verbose --config $(TESTS_DIR)/.coveralls.local.yml
101+ $(DOCKER_PHP) ./$(COVERALLS_DIR)/bin/php-coveralls --verbose \
102+ --config $(TESTS_DIR)/.coveralls.local.yml
79103endif
80104
81105
82106.PHONY : clean
83107clean :
84- git clean -xdff $(TEMP_DIR ) $(TESTS_TEMP_DIR ) $(shell find $(TESTS_DIR ) -type d -name output) $(VENDOR_DIR ) \
108+ git clean -xdff $(TEMP_DIR ) $(TESTS_TEMP_DIR ) \
109+ $(shell find $(TESTS_DIR ) -type d -name output) $(VENDOR_DIR ) \
85110 $(shell ls -Ap | grep -v '/\|composer.lock')
86111
87112
0 commit comments