Skip to content

Commit c8d8a55

Browse files
Merge branch 'develop' into feature/GOVCMSCT2-121
2 parents 6e76c02 + 762b087 commit c8d8a55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+273
-231
lines changed

.ahoy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ commands:
171171
usage: Lint front-end code (NodeJS dependencies should already be installed).
172172
cmd: |
173173
ahoy cli "npm run --prefix \${DREVOPS_WEBROOT}/themes/contrib/\${DRUPAL_THEME} lint"
174+
ahoy cli "vendor/bin/twig-cs-fixer lint"
174175
ahoy cli "vendor/bin/twig-cs-fixer lint --config=/app/web/themes/contrib/civictheme/.twig-cs-fixer.php /app/web/themes/contrib/civictheme"
175176
lint-check:
176177
cmd: |

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ job-build: &job-build
247247
name: Lint code with PHPMD
248248
command: docker compose exec -T cli vendor/bin/phpmd . text phpmd.xml || [ "${DREVOPS_CI_PHPMD_IGNORE_FAILURE:-0}" -eq 1 ]
249249
- run:
250-
name: Lint code with Twigcs
251-
command: docker compose exec -T cli vendor/bin/twigcs || [ "${DREVOPS_CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ]
250+
name: Lint code with Twig CS Fixer
251+
command: docker compose exec -T cli vendor/bin/twig-cs-fixer lint --config=/app/web/themes/contrib/civictheme/.twig-cs-fixer.php /app/web/themes/contrib/civictheme || [ "${CI_TWIGCSFIXER_IGNORE_FAILURE:-0}" -eq 1 ]
252252
- run:
253253
name: Lint code with NPM linters
254254
command: docker compose exec -T cli bash -c "npm run --prefix \${DREVOPS_WEBROOT}/themes/contrib/\${DRUPAL_THEME} lint" || [ "${DREVOPS_CI_NPM_LINT_IGNORE_FAILURE:-0}" -eq 1 ]

.docker/cli.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ RUN apk update \
4949
&& ln -sf python3 /usr/bin/python \
5050
&& rm -rf /var/cache/apk/*
5151

52+
RUN curl -L -o shipshape "https://github.com/salsadigitalauorg/shipshape/releases/download/v0.3.1/shipshape-$(uname -s)-$(uname -m)" && \
53+
chmod +x shipshape && \
54+
mv shipshape /usr/local/bin/shipshape
55+
5256
# Install updated version of NPM.
5357
RUN npm install -g npm@^8.6 && fix-permissions /home/.npm
5458

@@ -63,9 +67,6 @@ RUN mkdir -p web/themes/contrib/civictheme \
6367
&& mkdir -p web/modules/custom/civictheme_dev \
6468
&& mkdir -p web/modules/custom/cs_generated_content
6569

66-
# Add shipshape binary so that we can execute audits.
67-
COPY --from=ghcr.io/salsadigitalauorg/shipshape:latest /usr/local/bin/shipshape /usr/local/bin/shipshape
68-
6970
# Copy files required for PHP dependencies resolution.
7071
# Note that composer.lock is not explicitly copied, allowing to run the stack
7172
# without existing lock file (this is not advisable, but allows to build

.docker/cli.onlytheme.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ RUN apk update \
4848
&& ln -sf python3 /usr/bin/python \
4949
&& rm -rf /var/cache/apk/*
5050

51+
RUN curl -L -o shipshape "https://github.com/salsadigitalauorg/shipshape/releases/download/v0.3.1/shipshape-$(uname -s)-$(uname -m)" && \
52+
chmod +x shipshape && \
53+
mv shipshape /usr/local/bin/shipshape
54+
5155
# Install updated version of NPM.
5256
RUN npm install -g npm@^8.6 && fix-permissions /home/.npm
5357

@@ -62,9 +66,6 @@ RUN mkdir -p web/themes/contrib/civictheme \
6266
&& mkdir -p web/modules/custom/civictheme_dev \
6367
&& mkdir -p web/modules/custom/cs_generated_content
6468

65-
# Add shipshape binary so that we can execute audits.
66-
COPY --from=ghcr.io/salsadigitalauorg/shipshape:latest /usr/local/bin/shipshape /usr/local/bin/shipshape
67-
6869
# Copy files required for PHP dependencies resolution.
6970
# Note that composer.lock is not explicitly copied, allowing to run the stack
7071
# without existing lock file (this is not advisable, but allows to build

.docker/cli.sibling.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ RUN apk update \
4949
&& ln -sf python3 /usr/bin/python \
5050
&& rm -rf /var/cache/apk/*
5151

52+
RUN curl -L -o shipshape "https://github.com/salsadigitalauorg/shipshape/releases/download/v0.3.1/shipshape-$(uname -s)-$(uname -m)" && \
53+
chmod +x shipshape && \
54+
mv shipshape /usr/local/bin/shipshape
55+
5256
# Install updated version of NPM.
5357
RUN npm install -g npm@^8.6 && fix-permissions /home/.npm
5458

@@ -63,9 +67,6 @@ RUN mkdir -p web/themes/contrib/civictheme \
6367
&& mkdir -p web/modules/custom/civictheme_dev \
6468
&& mkdir -p web/modules/custom/cs_generated_content
6569

66-
# Add shipshape binary so that we can execute audits.
67-
COPY --from=ghcr.io/salsadigitalauorg/shipshape:latest /usr/local/bin/shipshape /usr/local/bin/shipshape
68-
6970
# Copy files required for PHP dependencies resolution.
7071
# Note that composer.lock is not explicitly copied, allowing to run the stack
7172
# without existing lock file (this is not advisable, but allows to build

.twig-cs-fixer.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

.twig-cs-fixer.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$ruleset = new TwigCsFixer\Ruleset\Ruleset();
6+
$ruleset->addStandard(new TwigCsFixer\Standard\Twig());
7+
$ruleset->addRule(new TwigCsFixer\Rules\Delimiter\BlockNameSpacingRule());
8+
$ruleset->addRule(new TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule());
9+
$ruleset->addRule(new TwigCsFixer\Rules\Function\NamedArgumentSpacingRule());
10+
$ruleset->addRule(new TwigCsFixer\Rules\Operator\OperatorNameSpacingRule());
11+
$ruleset->addRule(new TwigCsFixer\Rules\Operator\OperatorSpacingRule());
12+
$ruleset->addRule(new TwigCsFixer\Rules\Punctuation\PunctuationSpacingRule());
13+
$ruleset->addRule(new TwigCsFixer\Rules\Punctuation\TrailingCommaMultiLineRule());
14+
$ruleset->addRule(new TwigCsFixer\Rules\Punctuation\TrailingCommaSingleLineRule());
15+
$ruleset->addRule(new TwigCsFixer\Rules\Literal\HashQuoteRule());
16+
$ruleset->addRule(new TwigCsFixer\Rules\Literal\SingleQuoteRule());
17+
$ruleset->addRule(new TwigCsFixer\Rules\Variable\VariableNameRule(TwigCsFixer\Rules\Variable\VariableNameRule::SNAKE_CASE, '_'));
18+
$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\BlankEOFRule());
19+
$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\EmptyLinesRule());
20+
$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\IndentRule(2));
21+
$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\TrailingSpaceRule());
22+
23+
$finder = new TwigCsFixer\File\Finder();
24+
$finder->in(__DIR__ . '/web/modules/custom');
25+
$finder->in(__DIR__ . '/web/themes/contrib/civictheme/templates')->exclude([
26+
'.components-civictheme',
27+
'components_combined',
28+
]);
29+
30+
$config = new TwigCsFixer\Config\Config();
31+
$config->setRuleset($ruleset);
32+
$config->setFinder($finder);
33+
$config->allowNonFixableRules();
34+
$config->addTokenParser(new Drupal\Core\Template\TwigTransTokenParser());
35+
36+
return $config;

.twig_cs.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
"drupal/core-dev": "^11",
3636
"drupal/drupal-extension": "^5",
3737
"ergebnis/composer-normalize": "^2.42",
38-
"friendsoftwig/twigcs": "^6.2",
3938
"mglaman/phpstan-drupal": "^1.2",
4039
"palantirnet/drupal-rector": "^0.20",
4140
"php-parallel-lint/php-parallel-lint": "^1.3",
4241
"phpcompatibility/php-compatibility": "^9.3",
4342
"phpmd/phpmd": "^2.13",
4443
"phpspec/prophecy-phpunit": "^2.0",
4544
"phpstan/extension-installer": "^1.3",
46-
"pyrech/composer-changelogs": "^1.8"
45+
"pyrech/composer-changelogs": "^1.8",
46+
"vincentlanglet/twig-cs-fixer": "^3.9"
4747
},
4848
"conflict": {
4949
"drupal/drupal": "*"

composer.lock

Lines changed: 78 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)