Skip to content

Commit fcbf7db

Browse files
committed
chore: house-keeping add license to composer file, add instruction, special resources
1 parent a85cd17 commit fcbf7db

2 files changed

Lines changed: 32 additions & 70 deletions

File tree

.githooks/pre-commit

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -120,32 +120,37 @@ if [ -x $PEST ]; then
120120
HAS_PEST=true
121121
fi
122122

123-
# printf "${YELLOW}PEST Unit Tests${NC} "
124-
# if $HAS_PEST; then
125-
# # execute coverage tests
126-
# PEST_OUTPUT=$(XDEBUG_MODE=coverage $PEST --color=always --coverage-clover=clover.xml --coverage-html=coverage-report 2>&1)
127-
# if [ $? -eq 0 ]; then
128-
# printf "${GREEN}PASSED${NC}\n"
129-
# else
130-
# if [[ " ${protectedBranches[@]} " =~ " ${currentBranch} " ]] && [ "$allowFailuresInProtectedBranches" = false ]; then
131-
# printf "\n${PEST_OUTPUT}\n"
132-
# printf "${RED}Committing to protected branch ${currentBranch} is not allowed with failures.${NC}\n"
133-
# PASS=false
134-
# fi
135-
# if [[ ! " ${protectedBranches[@]} " =~ " ${currentBranch} " ]] && [ "$allowFailuresInOtherBranches" = false ]; then
136-
# printf "\n${PEST_OUTPUT}\n"
137-
# printf "${RED}Committing to ${currentBranch} is not allowed.${NC}\n"
138-
# PASS=false
139-
# fi
140-
# if [[ ! " ${protectedBranches[@]} " =~ " ${currentBranch} " ]] && [ "$allowFailuresInOtherBranches" = true ]; then
141-
# printf "${ORANGE}Committing to ${currentBranch} with test errors or failures.${NC}\n"
142-
# fi
143-
# fi
144-
# # add coverage report to current commit
145-
# git add clover.xml
146-
# else
147-
# printf "\npest is required. Install it with:\n\n composer require --dev pestphp/pest\n\n"
148-
# fi
123+
# add pest unit tests. stopping the commit if they fail
124+
HAS_PEST=false
125+
PEST="./vendor/bin/pest"
126+
if [ -x $PEST ]; then
127+
HAS_PEST=true
128+
fi
129+
printf "${YELLOW}Pest Unit Tests${NC}\n"
130+
if $HAS_PEST; then
131+
if [ -z "$CHANGED_FILES" ]; then
132+
printf "\nNo PHP file in this commit. Skipping Pest and Clover refresh.\n"
133+
printf "${YELLOW}Clover reports unchanged (no staged PHP files) at $(date '+%Y-%m-%d %H:%M:%S')${NC}\n"
134+
else
135+
if RUN $PEST tests/Unit --exclude-group=benchmark --exclude-group=external-bin --testdox --colors=always; then
136+
printf "${GREEN}Unit tests passed${NC}\n"
137+
138+
if RUN composer run test:coverage:unit \
139+
&& RUN composer run test:coverage:integration \
140+
&& RUN php bin/merge-clover.php clover.xml clover.unit.xml clover.integration.xml; then
141+
git add clover.unit.xml clover.integration.xml clover.xml
142+
printf "${GREEN}Clover reports updated (unit, integration, merged) at $(date '+%Y-%m-%d %H:%M:%S')${NC}\n"
143+
else
144+
printf "${RED}Coverage generation/merge failed${NC}\n"
145+
PASS=false
146+
fi
147+
else
148+
PASS=false
149+
fi
150+
fi
151+
else
152+
printf "\npest is required. Install it with:\n\n composer require --dev pestphp/pest\n\n"
153+
fi
149154

150155
# PHPMD - PHP Mess Detector
151156
source ./.githooks/pre-commit.d/phpmd.sh

docs/phpmd.md

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,6 @@ layout: home
44
# PHP Mess Detector Report
55

66
[[toc]]
7-
## Unused Code
8-
9-
| Priority | File | Line | Rule | Message |
10-
| -------- | ------ | ------------ | ----- | ------- |
11-
| <span class="prio3">3</span> | src/Command/BatchGeneratorCommand.php | 58 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$specification`. |
12-
| <span class="prio3">3</span> | src/Command/BatchGeneratorCommand.php | 95 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$elementShortName`. |
13-
| <span class="prio3">3</span> | src/Command/CreateClassCommand.php | 400 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$type`. |
14-
| <span class="prio3">3</span> | src/Command/GenerateComposedCommand.php | 57 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$specification`. |
15-
| <span class="prio3">3</span> | src/Command/MergeSpecifications.php | 26 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$input`. |
16-
| <span class="prio3">3</span> | src/Command/MergeSpecifications.php | 34 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$props`. |
17-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 37 | [UnusedPrivateField](https://phpmd.org/rules/unusedcode.html#unusedprivatefield) | Avoid unused private fields such as `$data`. |
18-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `parseFile`. |
19-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$generator`. |
20-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$sourceFile`. |
21-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$dest`. |
22-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$io`. |
23-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 224 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `formatHtml`. |
24-
| <span class="prio3">3</span> | src/Service/ComponentBuilder.php | 50 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$childElement`. |
25-
| <span class="prio3">3</span> | src/TemplateGenerator/BladeGenerator.php | 275 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
26-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 204 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$level`. |
27-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 213 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$propsInterface`. |
28-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 298 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$value`. |
29-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 565 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$choices`. |
30-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 575 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$type`. |
31-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 626 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$props`. |
32-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 629 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$renderAssignments`. |
33-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 743 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$level`. |
34-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 843 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
35-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 257 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$key`. |
36-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 450 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
37-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 626 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$document`. |
38-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 657 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$templateName`. |
39-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 155 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$level`. |
40-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 158 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$enums`. |
41-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 172 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$example`. |
42-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 200 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$setterMethod`. |
43-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 268 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$getter`. |
44-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 395 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `getGlobalAttributeTraits`. |
45-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 397 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$traits`. |
46-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 537 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$enumImports`. |
47-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 748 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$ref`. |
48-
49-
Issues detected: 37
507
## Code Size
518

529
| Priority | File | Line | Rule | Message |
@@ -1011,4 +968,4 @@ Issues detected: 746
1011968

1012969
Issues detected: 14
1013970

1014-
Sun May 3 11:05:28 CEST 2026
971+
Fri May 8 08:12:00 PM CEST 2026

0 commit comments

Comments
 (0)