nextcloud/coding-standard

Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
This commit is contained in:
Jean-Yves 2024-10-02 14:09:29 +02:00
parent 69d9c925d0
commit 161d8820fe
No known key found for this signature in database
GPG key ID: 644C8B9C4CABAEF7
5 changed files with 219 additions and 4 deletions

52
.github/workflows/lint-php-cs.yml vendored Normal file
View file

@ -0,0 +1,52 @@
# 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: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Lint php-cs
on:
pull_request:
paths:
- 'php/**'
push:
branches:
- main
paths:
- 'php/**'
permissions:
contents: read
concurrency:
group: lint-php-cs-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ "8.3" ]
name: php-cs
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
ini-file: development
- name: Install dependencies
run: cd php && composer i
- name: Lint
run: cd php && composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

3
.gitignore vendored
View file

@ -6,7 +6,8 @@
/php/session/*
!/php/data/.gitkeep
!/php/session/.gitkeep
/php/vendor
/php/vendor/
/php/.php-cs-fixer.cache
/manual-install/*.conf
!/manual-install/sample.conf

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config;
$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('data')
->notPath('session')
->notPath('public')
->notPath('vendor')
->in(__DIR__);
return $config;

View file

@ -21,10 +21,12 @@
"require-dev": {
"sserbin/twig-linter": "@dev",
"vimeo/psalm": "^5.25",
"wapmorgan/php-deprecation-detector": "dev-master"
"wapmorgan/php-deprecation-detector": "dev-master",
"nextcloud/coding-standard": "^1.3",
"friendsofphp/php-cs-fixer": "^3"
},
"scripts": {
"dev": [
"dev": [
"Composer\\Config::disableProcessTimeout",
"php -S localhost:8080 -t public"
],
@ -33,6 +35,8 @@
"psalm:strict": "psalm --threads=1 --show-info=true",
"lint": "php -l src/*.php src/**/*.php public/index.php",
"lint:twig": "twig-linter lint ./templates",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"php-deprecation-detector": "phpdd scan -n -t 8.3 src/*.php src/**/*.php public/index.php"
}
}

142
php/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0e1d24f3fa776163acefdebc91da39d3",
"content-hash": "b8bd0cb88d1582f9c4118112a24ac215",
"packages": [
{
"name": "guzzlehttp/guzzle",
@ -2416,6 +2416,52 @@
],
"time": "2024-08-06T10:04:20+00:00"
},
{
"name": "kubawerlos/php-cs-fixer-custom-fixers",
"version": "v3.22.0",
"source": {
"type": "git",
"url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git",
"reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e",
"reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e",
"shasum": ""
},
"require": {
"ext-filter": "*",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^3.61.1",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6.4 || ^10.5.29"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpCsFixerCustomFixers\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kuba Werłos",
"email": "werlos@gmail.com"
}
],
"description": "A set of custom fixers for PHP CS Fixer",
"support": {
"issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues",
"source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0"
},
"time": "2024-08-16T20:44:35+00:00"
},
{
"name": "netresearch/jsonmapper",
"version": "v4.5.0",
@ -2467,6 +2513,48 @@
},
"time": "2024-09-08T10:13:13+00:00"
},
{
"name": "nextcloud/coding-standard",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
"reference": "e88acb0df6217b808d1632286ddfec9267a102e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4",
"reference": "e88acb0df6217b808d1632286ddfec9267a102e4",
"shasum": ""
},
"require": {
"kubawerlos/php-cs-fixer-custom-fixers": "^3.22",
"php": "^7.3|^8.0",
"php-cs-fixer/shim": "^3.17"
},
"type": "library",
"autoload": {
"psr-4": {
"Nextcloud\\CodingStandard\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Wurst",
"email": "christoph@winzerhof-wurst.at"
}
],
"description": "Nextcloud coding standards for the php cs fixer",
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1"
},
"time": "2024-09-19T09:07:10+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.19.4",
@ -2523,6 +2611,58 @@
},
"time": "2024-09-29T15:01:53+00:00"
},
{
"name": "php-cs-fixer/shim",
"version": "v3.64.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "81ccfd24baf3a10810dab1152c403981a790b837"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837",
"reference": "81ccfd24baf3a10810dab1152c403981a790b837",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.4 || ^8.0"
},
"replace": {
"friendsofphp/php-cs-fixer": "self.version"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters."
},
"bin": [
"php-cs-fixer",
"php-cs-fixer.phar"
],
"type": "application",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0"
},
"time": "2024-08-30T23:10:11+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",