Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,57 @@ jobs:
- name: PHP lint
run: Build/Scripts/lint-php.sh

typoscript-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
tools: composer:v2

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: TypoScript lint
run: Build/Scripts/lint-typoscript.sh

xml-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
tools: composer:v2

- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: XML lint
run: Build/Scripts/lint-xml.sh

yaml-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install yamllint
run: pipx install yamllint

- name: YAML lint
run: Build/Scripts/lint-yaml.sh

documentation-rendering:
runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 21 additions & 0 deletions Build/Scripts/lint-typoscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Lints all TypoScript and TSconfig files of the extension with
# helmich/typo3-typoscript-lint, using Build/typoscriptlint.yaml.
# Warnings fail the lint as well.
#
# Usage:
# Build/Scripts/lint-typoscript.sh

source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

requireBinary typoscript-lint

paths=()
for path in Configuration Tests ext_typoscript_setup.typoscript; do
if [ -e "${path}" ]; then
paths+=("${path}")
fi
done

runPhp "${BIN_DIR}/typoscript-lint" --config Build/typoscriptlint.yaml --fail-on-warnings "${paths[@]}"
27 changes: 27 additions & 0 deletions Build/Scripts/lint-xml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# Validates the xml files of the extension against their schemas:
# - XLIFF files in Resources/Private/Language against XLIFF 1.2 strict
# (Build/xliff-core-1.2-strict.xsd, imports Build/xml.xsd)
# - Build/phpunit.xml.dist against the schema of the installed PHPUnit
#
# xmllint is not installed via composer. It is provided by shell.nix, in CI it
# is installed via apt (libxml2-utils).
#
# Usage:
# Build/Scripts/lint-xml.sh

source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

if ! command -v xmllint > /dev/null; then
echo "Missing xmllint, please install it first, e.g. the package libxml2-utils." >&2
exit 1
fi
requireBinary phpunit

if [ -d Resources/Private/Language ]; then
find Resources/Private/Language -name '*.xlf' -print0 \
| xargs -0 -r xmllint --schema Build/xliff-core-1.2-strict.xsd --noout
fi

xmllint --schema .Build/vendor/phpunit/phpunit/phpunit.xsd --noout Build/phpunit.xml.dist
19 changes: 19 additions & 0 deletions Build/Scripts/lint-yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Lints all yaml files of the extension with yamllint, using
# Build/yamllint.yaml. Files ignored by .gitignore are skipped.
#
# yamllint is not installed via composer. It is provided by shell.nix, in CI it
# is installed via pipx.
#
# Usage:
# Build/Scripts/lint-yaml.sh

source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

if ! command -v yamllint > /dev/null; then
echo "Missing yamllint, please install it first, e.g. \"pipx install yamllint\"." >&2
exit 1
fi

yamllint --config-file Build/yamllint.yaml .
11 changes: 6 additions & 5 deletions Build/typoscriptlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ sniffs:
parameters:
useSpaces: true
indentPerLevel: 4
indentConditions: false
indentConditions: true
- class: DeadCode
- class: OperatorWhitespace
# Values like validator names or paths are repeated on purpose. Moving them
# to constants would add them to the public configuration of the extension.
- class: RepeatingRValue
parameters:
allowedRightValues:
- "TYPO3\\CMS\\Frontend\\DataProcessing\\DatabaseQueryProcessor"
disabled: true
- class: DuplicateAssignment
- class: EmptySection
- class: NestingConsistency
parameters:
commonPathPrefixThreshold: 1
filePatterns:
- "*.typoscript"
- "*.typoscript"
- "*.tsconfig"
Loading
Loading