Skip to content

Commit

Permalink
Cleanup add captain hook
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbochmann committed Nov 27, 2024
1 parent 75700ea commit 211676e
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 9 deletions.
5 changes: 1 addition & 4 deletions Classes/Controller/BackendModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@

use DMK\Mklog\Domain\Model\DevlogEntryDemand;
use DMK\Mklog\Domain\Repository\DevlogEntryRepository;
use DMK\Mklog\Utility\VersionUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Pagination\ArrayPaginator;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;

Expand Down Expand Up @@ -77,7 +74,7 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
return $this->view->renderResponse('BackendModule');
}

protected function getView(ServerRequestInterface $request)
protected function getView(ServerRequestInterface $request): ModuleTemplate
{
return $this->moduleTemplateFactory->create($request);
}
Expand Down
59 changes: 59 additions & 0 deletions captainhook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"config": {
"vendor-directory": ".Build/vendor",
"bootstrap": ".Build/vendor/autoload.php"
},
"commit-msg": {
"enabled": true,
"actions": [
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
"options": []
},
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Regex",
"options": {
"regex": "#^(Cleanup|Bugfix|Version) .*#i",
"error": "Commit message has to start with ' #XXX' or 'Cleanup' or 'Bugfix' or 'Version'"
},
"conditions": []
}
]
},
"pre-push": {
"enabled": true,
"actions": [
{
"action": "composer test",
"options": [],
"conditions": []
}
]
},
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "composer lint",
"options": [],
"conditions": []
}
]
},
"prepare-commit-msg": {
"enabled": false,
"actions": []
},
"post-commit": {
"enabled": false,
"actions": []
},
"post-merge": {
"enabled": false,
"actions": []
},
"post-checkout": {
"enabled": false,
"actions": []
}
}
17 changes: 12 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"phpstan/extension-installer": "^1.1",
"saschaegerer/phpstan-typo3": "^1.0",
"typo3/testing-framework": "^8.0 || ^9.0",
"ssch/typo3-rector": "^2.8"
"ssch/typo3-rector": "^2.8",
"captainhook/captainhook": "^5.10"
},
"autoload": {
"classmap": [
Expand Down Expand Up @@ -93,14 +94,20 @@
}
},
"scripts": {
"post-autoload-dump": [
"[ -e .Build/bin/captainhook ] && .Build/bin/captainhook install -f || echo 'CaptainHook missing, skip install.'"
],
"runqa": [
"@fix",
"@lint",
"@test"
],
"lint:php": [
"[ -e .Build/bin/parallel-lint ] || composer update",
".Build/bin/parallel-lint ./Classes"
"echo 'parallel-lint fails with a exception if executed inside the vendor/dmk/mklog folder'",
"[ -e ../../autoload.php ] && mv ../../autoload.php ../../autoload.php.bak",
".Build/bin/parallel-lint ./Classes",
"[ -e ../../autoload.php.bak ] && mv ../../autoload.php.bak ../../autoload.php"
],
"lint": [
"@lint:php"
Expand All @@ -110,11 +117,11 @@
".Build/bin/php-cs-fixer fix -v --dry-run --diff --ansi"
],
"test:phpcompatibility": [
"@test:phpcompatibility:8"
"@test:phpcompatibility:8.x"
],
"test:phpcompatibility:8": [
"test:phpcompatibility:8.x": [
"[ -e .Build/bin/phpcs ] || composer update",
".Build/bin/phpcs --ignore=.Build/*,Resources/Private/PHP/* -p . --standard=.Build/vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1-8.3"
".Build/bin/phpcs --ignore=.Build/*,Resources/Private/PHP/* -p . --standard=.Build/vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1-8.4"
],
"test:phpmd": [
"[ -e .Build/bin/phpmd ] || composer update --ansi",
Expand Down

0 comments on commit 211676e

Please sign in to comment.