diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-04-21 14:34:32 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-04-21 14:34:32 +0300 |
commit | 94e700d1371a01c17ac2bc29d00bd36010732d53 (patch) | |
tree | 90e05e47d9b97269b3e90cf176b7bf67b79c1de4 | |
parent | 8ae8852183e645063403b7fa067d916869874d74 (diff) |
Add psalm
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | .github/workflows/static-analysis.yml | 31 | ||||
-rw-r--r-- | composer.json | 37 | ||||
-rw-r--r-- | composer.lock | 53 | ||||
-rw-r--r-- | psalm.xml | 53 |
4 files changed, 147 insertions, 27 deletions
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..0c073ef9 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,31 @@ +name: Static analysis + +on: + pull_request: + push: + branches: + - master + - stable* + +jobs: + static-psalm-analysis: + runs-on: ubuntu-latest + strategy: + matrix: + ocp-version: [ 'dev-master' ] + name: Nextcloud ${{ matrix.ocp-version }} + steps: + - name: Checkout + uses: actions/checkout@master + - name: Set up php + uses: shivammathur/setup-php@master + with: + php-version: 7.4 + tools: composer:v1 + coverage: none + - name: Install dependencies + run: composer i + - name: Install dependencies + run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }} + - name: Run coding standards check + run: composer run psalm diff --git a/composer.json b/composer.json index 720abd41..c49b032d 100644 --- a/composer.json +++ b/composer.json @@ -1,19 +1,22 @@ { - "name": "nextcloud/richdocuments", - "type": "project", - "require-dev": { - "roave/security-advisories": "dev-master", - "christophwurst/nextcloud": "^21@dev", - "jakub-onderka/php-parallel-lint": "^1.0.0" - }, - "license": "AGPLv3", - "authors": [ - { - "name": "Julius Härtl", - "email": "jus@bitgrid.net" - } - ], - "scripts": { - "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l" - } + "name": "nextcloud/richdocuments", + "type": "project", + "require-dev": { + "roave/security-advisories": "dev-master", + "christophwurst/nextcloud": "^21.0", + "jakub-onderka/php-parallel-lint": "^1.0.0", + "psalm/phar": "^4.7" + }, + "license": "AGPLv3", + "authors": [ + { + "name": "Julius Härtl", + "email": "jus@bitgrid.net" + } + ], + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "psalm": "psalm.phar", + "psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType" + } } diff --git a/composer.lock b/composer.lock index 1e64b6c8..05a570f4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,26 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "75520cba04bcdd341ddd74fb8bfb97da", + "content-hash": "90f8328b3e89d8d8cafc03dfa5099c14", "packages": [], "packages-dev": [ { "name": "christophwurst/nextcloud", - "version": "dev-master", + "version": "v21.0.0", "source": { "type": "git", "url": "https://github.com/ChristophWurst/nextcloud_composer.git", - "reference": "66d307aadf7334296c57afc0e7b9ef588cf4f2a9" + "reference": "41e1476b4aed5bce7371895054049eca353729c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/66d307aadf7334296c57afc0e7b9ef588cf4f2a9", - "reference": "66d307aadf7334296c57afc0e7b9ef588cf4f2a9", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/41e1476b4aed5bce7371895054049eca353729c5", + "reference": "41e1476b4aed5bce7371895054049eca353729c5", "shasum": "" }, "require": { "php": "^7.3 || ~8.0.0" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -44,9 +43,9 @@ "description": "Composer package containing Nextcloud's public API (classes, interfaces)", "support": { "issues": "https://github.com/ChristophWurst/nextcloud_composer/issues", - "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/master" + "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/v21.0.0" }, - "time": "2021-01-29T02:16:34+00:00" + "time": "2021-03-01T08:42:25+00:00" }, { "name": "jakub-onderka/php-parallel-lint", @@ -97,6 +96,41 @@ "time": "2018-02-24T15:31:20+00:00" }, { + "name": "psalm/phar", + "version": "4.7.0", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "ca25f9b91842cfe0186259aaaa694d2a6fe83c05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/ca25f9b91842cfe0186259aaaa694d2a6fe83c05", + "reference": "ca25f9b91842cfe0186259aaaa694d2a6fe83c05", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/refs/tags/4.7.0" + }, + "time": "2021-03-29T04:06:44+00:00" + }, + { "name": "roave/security-advisories", "version": "dev-master", "source": { @@ -315,8 +349,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "roave/security-advisories": 20, - "christophwurst/nextcloud": 20 + "roave/security-advisories": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000..32b9716f --- /dev/null +++ b/psalm.xml @@ -0,0 +1,53 @@ +<?xml version="1.0"?> +<psalm + errorLevel="4" + resolveFromConfigFile="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="https://getpsalm.org/schema/config" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + errorBaseline="tests/psalm-baseline.xml" +> + <projectFiles> + <directory name="lib" /> + <ignoreFiles> + <directory name="vendor" /> + </ignoreFiles> + </projectFiles> + <extraFiles> + <directory name="vendor" /> + <ignoreFiles> + <directory name="vendor/jakub-onderka" /> + </ignoreFiles> + </extraFiles> + <issueHandlers> + <UndefinedMagicMethod> + <errorLevel type="suppress"> + <referencedMethod name="/Db\\.*::.*/" /> + </errorLevel> + </UndefinedMagicMethod> + <UndefinedInterfaceMethod> + <errorLevel type="suppress"> + <!-- FIXME Deprecated event handling --> + <referencedMethod name="OCP\IUserManager::listen" /> + <referencedMethod name="OCP\IGroupManager::listen" /> + </errorLevel> + </UndefinedInterfaceMethod> + <UndefinedClass> + <errorLevel type="suppress"> + <referencedClass name="OC\*" /> + <referencedClass name="OC" /> + <referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" /> + </errorLevel> + </UndefinedClass> + <UndefinedDocblockClass> + <errorLevel type="suppress"> + <referencedClass name="OC\*" /> + <referencedClass name="Doctrine\DBAL\Schema\Schema" /> + <referencedClass name="Doctrine\DBAL\Schema\SchemaException" /> + <referencedClass name="Doctrine\DBAL\Driver\Statement" /> + <referencedClass name="Doctrine\DBAL\Schema\Table" /> + <referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" /> + </errorLevel> + </UndefinedDocblockClass> + </issueHandlers> +</psalm> |