Skip to content

[#2782] Added installer selection for Twig CS Fixer in the Tools multiselect.#2783

Merged
AlexSkrypnyk merged 3 commits into
mainfrom
feature/2782-twig-cs-fixer2
Jul 9, 2026
Merged

[#2782] Added installer selection for Twig CS Fixer in the Tools multiselect.#2783
AlexSkrypnyk merged 3 commits into
mainfrom
feature/2782-twig-cs-fixer2

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jul 9, 2026

Copy link
Copy Markdown
Member

Closes #2782

Summary

Twig CS Fixer was the last linter shipped unconditionally by Vortex: its siblings - PHPCS, PHPStan, Rector, ESLint and Stylelint - are all selectable through the Tools multiselect handler, but vincentlanglet/twig-cs-fixer and its CI step had no installer opt-out.
This adds a TWIG_CS_FIXER entry to Tools::getToolDefinitions() so deselecting it removes the composer dependency, the .twig-cs-fixer.php config, the ahoy lint commands, and the CI step in both providers - the same pattern already used for the other linters, and the direct follow-up to the Gitleaks installer selection added in #2781.

Changes

  • Installer: added a TWIG_CS_FIXER entry to Tools::getToolDefinitions() in .vortex/installer/src/Prompts/Handlers/Tools.php (present detection via a vincentlanglet/twig-cs-fixer composer reference or an existing .twig-cs-fixer.php; removes the composer dependency, the config file, and the ahoy cli vendor/bin/twig-cs-fixer lint/lint --fix commands), and added it to the default and discoverable tool lists.
  • CI: wrapped the "Lint code with Twig CS Fixer" step in #;< TOOL_TWIG_CS_FIXER / #;> TOOL_TWIG_CS_FIXER fences in both .github/workflows/build-test-deploy.yml and .circleci/config.yml, matching the fencing already used for TOOL_PHPCS and the other conditional tools.
  • Tests: added tools - discovery - twig_cs_fixer and tools - discovery - twig_cs_fixer, alt cases to ToolsHandlerDiscoveryTest, added the twig-cs-fixer/vincentlanglet/twig-cs-fixer pair to the "all tools installed" assertion in ToolsHandlerProcessTest, and added tools_no_twig / tools_no_twig_circleci scenarios exercising both CI providers; updated the shared AbstractHandlerDiscoveryTestCase::getExpectedDefaults()/getExpectedInstalled() baseline to include Tools::TWIG_CS_FIXER.
  • Fixtures: regenerated the .vortex/installer/tests/Fixtures/handler_process/ snapshots - new tools_no_twig and tools_no_twig_circleci scenario fixtures, and an updated tools_none to reflect the additional tool.
  • Docs: regenerated the installer demo video assets (installer.json/.svg/.png) so the recorded Tools list includes the new option.

Screenshots

N/A - template repository with no running site to capture; the installer demo asset is part of the diff (.vortex/docs/static/img/installer.png).

Before / After

Installer "Tools" multiselect - selectable tools before vs after:

BEFORE (8 selectable)                     AFTER (9 selectable)
──────────────────────────────            ──────────────────────────────────────
Tools                                     Tools
├─ PHP CodeSniffer                        ├─ PHP CodeSniffer
├─ PHPStan                                ├─ PHPStan
├─ Rector                                 ├─ Rector
├─ PHPUnit                                ├─ PHPUnit
├─ Behat                                  ├─ Behat
├─ ESLint                                 ├─ ESLint
├─ Jest                                   ├─ Jest
└─ Stylelint                              ├─ Stylelint
                                           └─ Twig CS Fixer   [new, default: selected]

Twig CS Fixer always shipped,             Twig CS Fixer no longer unconditional -
no installer opt-out                      matches every other linter in the list

CI YAML step - unconditional versus fenced/conditional:

BEFORE (always shipped)                   AFTER (installer-controlled)
────────────────────────                  ──────────────────────────────────────
┌────────────────────────────┐            ┌─────────────────────────────────────┐
│ - Lint code with Rector     │            │ - Lint code with Rector              │
│ - Lint code with Twig CS    │            │ #;< TOOL_TWIG_CS_FIXER               │
│   Fixer                     │            │ - Lint code with Twig CS Fixer       │
│ - Lint code with Gherkin    │            │ #;> TOOL_TWIG_CS_FIXER               │
│   Lint                      │            │ - Lint code with Gherkin Lint        │
└────────────────────────────┘            └─────────────────────────────────────┘

                                           Twig CS Fixer selected (default)
                                             → fences stripped, step kept as-is
                                           Twig CS Fixer deselected
                                             → fenced block, composer dependency,
                                               config file and ahoy commands
                                               all removed

Summary by CodeRabbit

  • New Features

    • Added support for Twig CS Fixer as an available code-quality tool.
    • Projects can now detect this tool from either dependency configuration or a local config file.
    • Linting and auto-fix commands are now recognized for Twig templates.
  • Bug Fixes

    • Updated CI and setup handling so Twig CS Fixer is consistently included or removed based on the selected tools.
  • Tests

    • Expanded test coverage for tool detection and exclusion scenarios.

@github-project-automation github-project-automation Bot moved this to BACKLOG in Vortex 1.x Jul 9, 2026
@AlexSkrypnyk AlexSkrypnyk added this to the 1.41.0 milestone Jul 9, 2026
@AlexSkrypnyk AlexSkrypnyk added the A1 Board worker 1 label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f2ec0170-4c43-4442-88ba-49005e205cd1

📥 Commits

Reviewing files that changed from the base of the PR and between 7655131 and 360ebc0.

⛔ Files ignored due to path filters (28)
  • .vortex/docs/static/img/installer.png is excluded by !**/*.png
  • .vortex/docs/static/img/installer.svg is excluded by !**/*.svg
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/-.twig-cs-fixer.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.ahoy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.dockerignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.github/workflows/build-test-deploy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/.gitignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig/composer.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/-.twig-cs-fixer.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.ahoy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/config.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/post-coverage-comment.sh is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.dockerignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.github/workflows/-build-test-deploy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.gitignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/README.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/composer.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/docs/ci.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/tests/phpunit/CircleCiConfigTest.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/tests/phpunit/Drupal/EnvironmentSettingsTest.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/web/sites/default/includes/providers/-settings.gha.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/web/sites/default/includes/providers/settings.circleci.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/-.twig-cs-fixer.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/.ahoy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/.dockerignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/.github/workflows/build-test-deploy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/.gitignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_none/composer.json is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (7)
  • .circleci/config.yml
  • .github/workflows/build-test-deploy.yml
  • .vortex/docs/static/img/installer.json
  • .vortex/installer/src/Prompts/Handlers/Tools.php
  • .vortex/installer/tests/Functional/Handlers/ToolsHandlerProcessTest.php
  • .vortex/installer/tests/Unit/Handlers/AbstractHandlerDiscoveryTestCase.php
  • .vortex/installer/tests/Unit/Handlers/ToolsHandlerDiscoveryTest.php

Walkthrough

Adds a new TWIG_CS_FIXER tool option to the installer's Tools multiselect handler, enabling conditional inclusion/removal of the Twig CS Fixer linter (composer dependency, config file, CI step, Ahoy commands). CI configs in both CircleCI and GitHub Actions are wrapped with matching TOOL_TWIG_CS_FIXER markers. Tests updated accordingly.

Changes

Twig CS Fixer Tool Selection

Layer / File(s) Summary
Tools handler definition
.vortex/installer/src/Prompts/Handlers/Tools.php
Adds TWIG_CS_FIXER constant, includes it in default selection, and defines presence detection, composer/file removal, and Ahoy command entries.
CI config marker wrapping
.circleci/config.yml, .github/workflows/build-test-deploy.yml
Wraps existing Twig CS Fixer lint step with TOOL_TWIG_CS_FIXER marker comments; command logic unchanged.
Discovery and defaults tests
.vortex/installer/tests/Unit/Handlers/AbstractHandlerDiscoveryTestCase.php, .vortex/installer/tests/Unit/Handlers/ToolsHandlerDiscoveryTest.php
Updates expected default/discovered tool sets and adds test cases detecting the tool via composer dependency or config file.
Process removal tests
.vortex/installer/tests/Functional/Handlers/ToolsHandlerProcessTest.php
Adds assertions and dataset entries verifying twig-cs-fixer artifacts are removed when the tool is deselected.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: Needs review

Poem

A rabbit hops through CI fences tall,
Marking Twig CS Fixer, one and all 🐇
Toggle it off, or leave it be,
Composer, Ahoy, and config file — free!
Hop, test, and merge — carrots for all! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding Twig CS Fixer to the installer’s Tools multiselect.
Linked Issues check ✅ Passed The PR implements the requested Twig CS Fixer installer selection, including tool definition, removal behavior, CI step fencing, and tests.
Out of Scope Changes check ✅ Passed The changes stay within the Twig CS Fixer installer-selection feature and supporting tests/CI markers, with no obvious unrelated edits.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2782-twig-cs-fixer2

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.55% (204/207)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.27%. Comparing base (7655131) to head (360ebc0).

Files with missing lines Patch % Lines
...Unit/Handlers/AbstractHandlerDiscoveryTestCase.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2783      +/-   ##
==========================================
- Coverage   86.67%   86.27%   -0.40%     
==========================================
  Files          97       90       -7     
  Lines        4742     4598     -144     
  Branches       47        3      -44     
==========================================
- Hits         4110     3967     -143     
+ Misses        632      631       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a4f676cd2b1f330c6130aad--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jul 9, 2026
@AlexSkrypnyk AlexSkrypnyk merged commit 3aa2c52 into main Jul 9, 2026
34 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2782-twig-cs-fixer2 branch July 9, 2026 09:59
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A1 Board worker 1 Needs review Pull request needs a review from assigned developers

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

Add installer selection for Twig CS Fixer in the Tools multiselect

1 participant