aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2025-04-08 08:35:59 +0200
committerGitHub <noreply@github.com>2025-04-08 08:35:59 +0200
commitae0bb4eaa210381ae55fe347ddccac0747a5b67d (patch)
treed841f881015972cc30f210f2ce36099116cd360c
parent815d98547031290c5f19b264744049b2e7963087 (diff)
parent16188cd7674f4dd82daef298fa3553f9b0751b49 (diff)
downloadnextcloud-server-ae0bb4eaa210381ae55fe347ddccac0747a5b67d.tar.gz
nextcloud-server-ae0bb4eaa210381ae55fe347ddccac0747a5b67d.zip
Merge pull request #51945 from nextcloud/chore/psalm-test
chore: test that all apps are covered by psalm
-rw-r--r--.github/workflows/autocheckers.yml3
-rw-r--r--apps/profile/templates/404-profile.php2
-rwxr-xr-xbuild/psalm-checker.sh31
-rw-r--r--psalm.xml1
4 files changed, 36 insertions, 1 deletions
diff --git a/.github/workflows/autocheckers.yml b/.github/workflows/autocheckers.yml
index 1c7dcc014d0..75f9f62d80e 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/apps/profile/templates/404-profile.php b/apps/profile/templates/404-profile.php
index 8a1084b3911..2d34a9e7614 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
new file mode 100755
index 00000000000..a56fecebe52
--- /dev/null
+++ b/build/psalm-checker.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+if [ -d "dist" ]; then
+ missing=''
+ 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 - $app\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 0fdbc287b5a..5952ac50463 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -36,6 +36,7 @@
<directory name="apps/files_versions"/>
<directory name="apps/lookup_server_connector"/>
<directory name="apps/oauth2"/>
+ <directory name="apps/profile"/>
<directory name="apps/provisioning_api"/>
<directory name="apps/settings"/>
<directory name="apps/sharebymail"/>