Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add psalm for code analysis #911

Merged
merged 3 commits into from
Sep 14, 2024
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
44 changes: 44 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Static analysis

on: pull_request

concurrency:
group: psalm-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
static-analysis:
runs-on: ubuntu-latest

name: static-psalm-analysis
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Get php version
id: versions
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1

- name: Set up php${{ steps.versions.outputs.php-available }}
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
with:
php-version: ${{ steps.versions.outputs.php-available }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer i

- name: Run coding standards check
run: composer run psalm
28 changes: 8 additions & 20 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,31 @@ SPDX-PackageSupplier = "Nextcloud <[email protected]>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/suspicious_login"

[[annotations]]
path = [".tx/config", "l10n/**.js", "l10n/**.json", "screenshots/admin_settings.png", "screenshots/notification_android.png", "screenshots/notification_web.png"]
path = [".tx/config", "l10n/**.js", "l10n/**.json", "**/composer.json", "**/composer.lock", "package.json", "package-lock.json", "renovate.json", ".github/CODEOWNERS", "tests/psalm-baseline.xml"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2019 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = [".github/CODEOWNERS", "renovate.json"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2023 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
SPDX-FileCopyrightText = "2021 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = ["composer.json", "composer.lock"]
path = ["tsconfig.json", "vite.config.ts"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2018 Nextcloud GmbH and Nextcloud contributors"
SPDX-FileCopyrightText = "2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = ["vendor-bin/php-cs-fixer/composer.json", "vendor-bin/php-cs-fixer/composer.lock"]
path = ["css/*.css", "css/*.map", "js/*.js.map"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = ["package.json", "package-lock.json", "tests/phpunit.xml"]
path = ["screenshots/*.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2019 Nextcloud GmbH and Nextcloud contributors"
SPDX-FileCopyrightText = "2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"

[[annotations]]
path = ["img/app.svg", "img/app-dark.svg"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2018-2024 Google LLC"
SPDX-License-Identifier = "Apache-2.0"

[[annotations]]
path = ["js/settings.js", "js/settings.js.LICENSE.txt", "js/settings.js.map"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2019 Nextcloud GmbH and Nextcloud contributors, 2020 Chart.js Contributors, 2014-2022 Evan You, 2011-2023 Tim Wood, Iskren Chernev, Moment.js contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later AND MIT"
80 changes: 42 additions & 38 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
{
"name": "christophwurst/suspicious_login",
"description": "Detect and warn about suspicious IPs logging into Nextcloud",
"type": "library",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/nextcloud-deps/RubixML"
}
],
"require": {
"amphp/amp": "^2.6.4",
"amphp/parallel": "^1.4.3",
"bamarni/composer-bin-plugin": "^1.8.2",
"rubix/ml": "dev-chore/bump-flysystem-v2.1.1"
},
"license": "AGPLv3",
"authors": [
{
"name": "Christoph Wurst",
"email": "[email protected]"
}
],
"scripts": {
"cs:check": "vendor-bin/php-cs-fixer/vendor/php-cs-fixer/shim/php-cs-fixer fix --dry-run --diff",
"cs:fix": "vendor-bin/php-cs-fixer/vendor/php-cs-fixer/shim/php-cs-fixer fix",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"test": "phpunit -c tests/phpunit.xml",
"test:unit": "phpunit -c tests/phpunit.xml tests/Unit",
"test:unit:dev": "phpunit -c tests/phpunit.xml tests/Unit --no-coverage",
"name": "christophwurst/suspicious_login",
"description": "Detect and warn about suspicious IPs logging into Nextcloud",
"type": "library",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/nextcloud-deps/RubixML"
}
],
"require": {
"amphp/amp": "^2.6.4",
"amphp/parallel": "^1.4.3",
"bamarni/composer-bin-plugin": "^1.8.2",
"rubix/ml": "dev-chore/bump-flysystem-v2.1.1"
},
"license": "AGPLv3",
"authors": [
{
"name": "Christoph Wurst",
"email": "[email protected]"
}
],
"scripts": {
"cs:check": "vendor-bin/php-cs-fixer/vendor/php-cs-fixer/shim/php-cs-fixer fix --dry-run --diff",
"cs:fix": "vendor-bin/php-cs-fixer/vendor/php-cs-fixer/shim/php-cs-fixer fix",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"test": "phpunit -c tests/phpunit.xml",
"test:unit": "phpunit -c tests/phpunit.xml tests/Unit",
"test:unit:dev": "phpunit -c tests/phpunit.xml tests/Unit --no-coverage",
"post-install-cmd": ["@composer bin all install --ansi"],
"post-update-cmd": ["@composer bin all update --ansi"]
},
"require-dev": {
"christophwurst/nextcloud_testing": "^0.12.4"
},
"post-update-cmd": ["@composer bin all update --ansi"],
"psalm": "psalm --threads=1",
"psalm:update-baseline": "psalm --threads=1 --update-baseline",
"psalm:update-baseline:force": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache"
},
"require-dev": {
"christophwurst/nextcloud_testing": "^0.12.4"
},
"config": {
"sort-packages": true,
"optimize-autoloader": true,
"classmap-authoritative": true,
"autoloader-suffix": "SuspiciousLogin",
"platform": {
"php": "8.0"
"php": "8.1"
},
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"autoload" : {
"psr-4": {
Expand Down
Loading
Loading