Skip to content

Commit 7e0798e

Browse files
authored
Feat(CI): TwigCS (#173)
1 parent 56fa59d commit 7e0798e

File tree

5 files changed

+90
-15
lines changed

5 files changed

+90
-15
lines changed

.twig_cs.dist.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use FriendsOfTwig\Twigcs;
6+
7+
$finder = Twigcs\Finder\TemplateFinder::create()
8+
->in(__DIR__ . '/templates')->in(__DIR__ . '/templates/components')
9+
->name('*.html.twig')
10+
->ignoreVCSIgnored(true);
11+
12+
return Twigcs\Config\Config::create()
13+
->setFinder($finder)
14+
->setRuleSet(\Glpi\Tools\GlpiTwigRuleset::class)
15+
;

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
},
55
"require-dev": {
66
"friendsofphp/php-cs-fixer": "^3.75",
7+
"friendsoftwig/twigcs": "^6.1",
78
"glpi-project/tools": "^0.7.4",
89
"php-parallel-lint/php-parallel-lint": "^1.4",
910
"phpstan/phpstan": "^2.1"
@@ -14,5 +15,10 @@
1415
"php": "7.4.0"
1516
},
1617
"sort-packages": true
18+
},
19+
"autoload-dev": {
20+
"psr-4": {
21+
"Glpi\\Tools\\": "../../tools/src/"
22+
}
1723
}
1824
}

composer.lock

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

templates/alert_form.html.twig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
item.fields,
9292
__('Show on pages', 'news'),
9393
base_option
94-
)}}
94+
) }}
9595
{{ fields.dropdownYesNo(
9696
'is_close_allowed',
9797
item.fields.is_close_allowed,
@@ -146,21 +146,21 @@
146146
item.fields.background_color,
147147
__('Background color', 'news'),
148148
base_option_small
149-
)}}
149+
) }}
150150
{{ news_fields.colorField(
151151
"text_color",
152152
colors,
153153
item.fields.text_color,
154154
__('Text color', 'news'),
155155
base_option_small
156-
)}}
156+
) }}
157157
{{ news_fields.colorField(
158158
"emphasis_color",
159159
colors,
160160
item.fields.emphasis_color,
161161
__('Emphasis color', 'news'),
162162
base_option_small
163-
)}}
163+
) }}
164164

165165
<div class="hr-text preview-section {{ item.isNewItem() ? "d-none" : "" }}">
166166
<i class="ti ti-eye"></i>
@@ -254,4 +254,3 @@
254254
</script>
255255

256256
{% endblock %}
257-

templates/display_alert.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
class="
4040
alert-{{ js_rand }}
4141
alert bg-{{ alert_fields.background_color }}
42-
{{ can_close ? "alert-dismissible" : ""}}
42+
{{ can_close ? "alert-dismissible" : "" }}
4343
"
4444
style="
4545
color: var(--tblr-{{ alert_fields.text_color }}) !important;
@@ -50,7 +50,7 @@
5050
<i class="ti ti-{{ alert_fields.icon }} fa-2x me-2"></i>
5151
<div class="overflow-hidden">
5252
<h3 class="mt-1">
53-
{{ alert_fields.name|verbatim_value }}
53+
{{ alert_fields.name|verbatim_value }}
5454
{% if show_only_login_alerts %}
5555
<a class="plugin_news_alert-toggle"></a>
5656
{% endif %}

0 commit comments

Comments
 (0)