-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (48 loc) · 1.89 KB
/
Makefile
File metadata and controls
59 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Define the PHP executable and commonly used paths
PHP := php
PHPUNIT := ./vendor/bin/phpunit
RECTOR := ./vendor/bin/rector
PHPCS := ./vendor/bin/phpcs
PHPCBF := ./vendor/bin/phpcbf
PHPCSARGS := --standard=PSR12 --exclude=Generic.NamingConventions.UpperCaseConstantName,PSR1.Methods.CamelCapsMethodName,PSR2.Methods.MethodDeclaration
# Default target
all: help
# PHPUnit target
test:
@echo "Running PHPUnit tests..."
$(PHPUNIT) --configuration phpunit.xml --colors=always
# Rector targets for code refactoring
rector:
@echo "Running Rector refactoring..."
$(RECTOR) process src --dry-run --clear-cache --config rector.php
rector-fix:
@echo "Applying Rector refactoring..."
$(RECTOR) process src --clear-cache --config rector.php
# PHPCS target for linting
lint:
@echo "Running PHP CodeSniffer (PHPCS) for linting..."
$(PHPCS) $(PHPCSARGS) src/
# PHPCBF target for auto-fixing code style issues
lint-fix:
@echo "Running PHP Code Beautifier and Fixer (PHPCBF) for auto-fixing..."
$(PHPCBF) $(PHPCSARGS) src/
# Clean up cache generated by Rector, PHPUnit, and PHPCS
clean:
@echo "Cleaning caches for Rector, PHPUnit, and PHPCS..."
rm -rf .rector/cache
rm -rf .phpunit.result.cache
rm -rf .phpcs.cache
# Run both test and lint targets
check: test lint
# Help menu
help:
@echo "Available targets:"
@echo " test - Run PHPUnit tests with default configuration"
@echo " rector - Run Rector in dry-run mode"
@echo " rector-fix - Apply Rector refactoring"
@echo " lint - Run PHP CodeSniffer (PHPCS) for code style checks"
@echo " lint-fix - Auto-fix code style issues with PHP Code Beautifier (PHPCBF)"
@echo " clean - Remove cache for Rector, PHPUnit, and PHPCS"
@echo " check - Run both tests and linting in dry-run mode"
# Phony targets to prevent issues with files named like targets
.PHONY: all test rector rector-fix lint lint-fix clean check help