From 4a64cf54bab1e5ec41aae6a7097873587fe682db Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 4 Apr 2025 16:56:02 +0200 Subject: [PATCH 1/3] ci: test that all apps are enabled for psalm Signed-off-by: Ferdinand Thiessen --- .github/workflows/autocheckers.yml | 3 +++ build/psalm-checker.sh | 26 ++++++++++++++++++++++++++ psalm.xml | 1 + 3 files changed, 30 insertions(+) create mode 100755 build/psalm-checker.sh diff --git a/.github/workflows/autocheckers.yml b/.github/workflows/autocheckers.yml index 1c7dcc014d052..75f9f62d80e5d 100644 --- a/.github/workflows/autocheckers.yml +++ b/.github/workflows/autocheckers.yml @@ -110,6 +110,9 @@ jobs: - name: Check that all and only expected files are included run: php ./build/files-checker.php + - name: Check that all shipped apps are linted by psalm + run: sh ./build/psalm-checker.sh + summary: permissions: contents: none diff --git a/build/psalm-checker.sh b/build/psalm-checker.sh new file mode 100755 index 0000000000000..f0288269bc4a7 --- /dev/null +++ b/build/psalm-checker.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +if [ -d "dist" ]; then + missing='' + for f in apps/*; do + grep "directory name=\"$f\"" psalm.xml 2>&1 > /dev/null + if [ $? -ne 0 ]; then + missing="$missing- $f\n" + fi + done + + if [ "$missing" = "" ]; then + echo "✅ All apps will be linted by psalm" + else + echo "❌ Following apps are not setup for linting using psalm:" + echo -e "$missing" + exit 1 + fi +else + echo "⚠️ This script needs to be executed from the root of the repository" + exit 1 +fi + diff --git a/psalm.xml b/psalm.xml index 0fdbc287b5ab1..5952ac5046303 100644 --- a/psalm.xml +++ b/psalm.xml @@ -36,6 +36,7 @@ + From 7b321ba4f2c1a823b6c538b46dda0789965b7785 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 4 Apr 2025 16:56:17 +0200 Subject: [PATCH 2/3] fix(profile): ensure correct base address Signed-off-by: Ferdinand Thiessen --- apps/profile/templates/404-profile.php | 2 +- build/psalm-checker.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/profile/templates/404-profile.php b/apps/profile/templates/404-profile.php index 8a1084b3911dd..2d34a9e7614ce 100644 --- a/apps/profile/templates/404-profile.php +++ b/apps/profile/templates/404-profile.php @@ -8,7 +8,7 @@ /** @var \OCP\Defaults $theme */ // @codeCoverageIgnoreStart if (!isset($_)) { //standalone page is not supported anymore - redirect to / - require_once '../../lib/base.php'; + require_once '../../../lib/base.php'; $urlGenerator = \OCP\Server::get(\OCP\IURLGenerator::class); header('Location: ' . $urlGenerator->getAbsoluteURL('/')); diff --git a/build/psalm-checker.sh b/build/psalm-checker.sh index f0288269bc4a7..679c42c4fa0c4 100755 --- a/build/psalm-checker.sh +++ b/build/psalm-checker.sh @@ -5,10 +5,15 @@ if [ -d "dist" ]; then missing='' - for f in apps/*; do - grep "directory name=\"$f\"" psalm.xml 2>&1 > /dev/null + for app in apps/*; do + if git check-ignore "$app" -q ; then + echo "ℹ️ Ignoring non shipped app: $app" + continue + fi + + grep "directory name=\"$app\"" psalm.xml 2>&1 > /dev/null if [ $? -ne 0 ]; then - missing="$missing- $f\n" + missing="$missing - $app\n" fi done From 16188cd7674f4dd82daef298fa3553f9b0751b49 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 7 Apr 2025 14:40:28 +0200 Subject: [PATCH 3/3] chore: adjust copyright year MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Ferdinand Thiessen --- build/psalm-checker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/psalm-checker.sh b/build/psalm-checker.sh index 679c42c4fa0c4..a56fecebe52ea 100755 --- a/build/psalm-checker.sh +++ b/build/psalm-checker.sh @@ -1,6 +1,6 @@ #!/bin/sh -# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: AGPL-3.0-or-later if [ -d "dist" ]; then