diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b3a582b9..2cfdc216 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -require_once __DIR__.'/vendor-bin/coding-standard/vendor/autoload.php'; +require_once __DIR__ . '/vendor-bin/coding-standard/vendor/autoload.php'; use Nextcloud\CodingStandard\Config; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..40088d53 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +# SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/nextcloud/pre-commit-php.git + rev: 1.5.1 + hooks: + - id: php-lint + - id: php-cs-fixer + files: \.(php)$ + exclude: ^(vendor|vendor-bin) + args: [] +- repo: local + hooks: + - id: check-dirty-version + name: Check updater.phar for dirty version + entry: tests/checkPharForDirtyVersion.sh + language: script + files: ^updater.phar$ diff --git a/tests/checkPharForDirtyVersion.sh b/tests/checkPharForDirtyVersion.sh new file mode 100755 index 00000000..e68ccbf0 --- /dev/null +++ b/tests/checkPharForDirtyVersion.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +grep --text "class Version {" -A3 updater.phar | grep -v dirty