diff --git a/README.md b/README.md index ee5bd0b..21b519a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ The following tools are automatically detected based on their configuration file | Composer Require Checker | `composer-require-checker.json` | | | Composer Dependency Analyser | `composer-dependency-analyser.php` | | | PHPBench | `phpbench.json` | | +| Twig-CS-Fixer | `.twig-cs-fixer.php`, `.twig-cs-fixer.dist.php` | | | Backward Compatibility Check | — | Optional; requires configuration in `.laminas-ci.json` | ### Documentation Linting diff --git a/src/tools.ts b/src/tools.ts index a99a01d..c9d6a21 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -11,6 +11,7 @@ import {PhpBenchTool} from './tools/phpbench'; import {CodeceptionTool} from './tools/codeception'; import {PhpCsFixerTool} from './tools/phpCsFixer'; import {PHPStanTool} from './tools/phpstan'; +import {TwigCsFixerTool} from './tools/twigCsFixer'; import {ToolExecutionType} from './enum/toolExecutionType'; import {ToolType} from './enum/toolType'; @@ -86,6 +87,7 @@ export default function createTools(config: Config): Array { CodeceptionTool, PhpCsFixerTool, PHPStanTool, + TwigCsFixerTool, backwardCompatibilityCheckTool(config), ].filter((tool) => tool !== null) as Tool[]; diff --git a/src/tools/twigCsFixer.ts b/src/tools/twigCsFixer.ts new file mode 100644 index 0000000..5823fc1 --- /dev/null +++ b/src/tools/twigCsFixer.ts @@ -0,0 +1,10 @@ +import {ToolType} from '../enum/toolType'; +import {ToolExecutionType} from '../enum/toolExecutionType'; + +export const TwigCsFixerTool = { + executionType : ToolExecutionType.STATIC, + name : 'Twig CS Fixer', + command : './vendor/bin/twig-cs-fixer lint --report checkstyle | cs2pr', + filesToCheck : [ '.twig-cs-fixer.php', '.twig-cs-fixer.dist.php' ], + toolType : ToolType.CODE_CHECK, +}; diff --git a/tests/code-check-twig-cs-fixer-php-dist/.laminas-ci.json b/tests/code-check-twig-cs-fixer-php-dist/.laminas-ci.json new file mode 100644 index 0000000..a912e7b --- /dev/null +++ b/tests/code-check-twig-cs-fixer-php-dist/.laminas-ci.json @@ -0,0 +1,3 @@ +{ + "stablePHP": "7.4" +} diff --git a/tests/code-check-twig-cs-fixer-php-dist/.twig-cs-fixer.dist.php b/tests/code-check-twig-cs-fixer-php-dist/.twig-cs-fixer.dist.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/tests/code-check-twig-cs-fixer-php-dist/.twig-cs-fixer.dist.php @@ -0,0 +1 @@ +