Skip to content

Commit 44ec33c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-dart-tests
2 parents da3e088 + ac31311 commit 44ec33c

File tree

97 files changed

+738
-391
lines changed

Some content is hidden

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

97 files changed

+738
-391
lines changed

.github/workflows/djlint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Twig Linting
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.twig'
7+
- '.github/workflows/djlint.yml'
8+
- 'pyproject.toml'
9+
push:
10+
branches:
11+
- master
12+
paths:
13+
- '**.twig'
14+
- '.github/workflows/djlint.yml'
15+
- 'pyproject.toml'
16+
17+
jobs:
18+
djlint:
19+
name: djLint - Twig Linter
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v4
28+
29+
- name: Run djLint linter
30+
run: |
31+
uvx djlint templates/ --lint

.github/workflows/sdk-build-validation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ jobs:
173173
;;
174174
php)
175175
composer install
176+
find . -name "*.php" ! -path "./vendor/*" -exec php -l {} +
176177
;;
177178
python)
178179
pip install -e .

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
- name: Setup PHP with PECL extension
9595
uses: shivammathur/setup-php@v2
9696
with:
97-
php-version: ${{ matrix.php-version }}
97+
php-version: '8.3'
9898
extensions: curl
9999

100100
- name: Install

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,31 @@ docker run --rm -v $(pwd):/app -w /app php:8.3-cli php example.php
122122
123123
Check your output files at: /examples/new-lang and make sure the SDK works. When possible, add some unit tests.
124124

125+
## Linting Twig Templates
126+
127+
We use [djLint](https://djlint.com/) to lint Twig template files for syntax errors and common issues. The linter runs automatically on pull requests.
128+
129+
**To lint templates locally:**
130+
```bash
131+
composer lint-twig
132+
```
133+
134+
**Requirements:**
135+
- [uv](https://github.com/astral-sh/uv) must be installed (for running `uvx` commands)
136+
137+
**Configuration:**
138+
- Located in `pyproject.toml`
139+
- Only linting is enabled (formatting is disabled to avoid breaking code generation)
140+
- Several rules are ignored as they produce false positives for code generation templates
141+
142+
**What the linter catches:**
143+
- Template syntax errors
144+
- Missing closing tags
145+
- Extra blank lines
146+
- Basic HTML structure issues
147+
148+
**Note:** If you encounter linting errors that seem incorrect for code generation templates, please discuss in your PR rather than disabling the linter.
149+
125150
## SDK Checklist
126151

127152
It is very important for us to create a consistent structure and architecture, as well as a language-native feel for the SDKs we generate.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ $sdk->generate(__DIR__ . '/examples/php'); // Generate source code
7070

7171
```
7272

73+
## Linting Twig Templates
74+
75+
This project uses [djLint](https://djlint.com/) to lint Twig template files for syntax and common issues.
76+
77+
**Note:** Formatting is disabled as it breaks code generation syntax. Only linting is used.
78+
79+
**Available command:**
80+
```bash
81+
composer lint-twig # Check for linting errors
82+
```
83+
84+
Requires [uv](https://github.com/astral-sh/uv) to be installed. Configuration is in `pyproject.toml`. The linter runs automatically on pull requests via GitHub Actions.
85+
7386
## Supported Specs
7487

7588
* [Swagger 2](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"scripts": {
1515
"test": "vendor/bin/phpunit",
1616
"lint": "vendor/bin/phpcs",
17-
"format": "vendor/bin/phpcbf"
17+
"format": "vendor/bin/phpcbf",
18+
"lint-twig": "uvx djlint templates/ --lint"
1819
},
1920
"autoload": {
2021
"psr-4": {

0 commit comments

Comments
 (0)