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

Phpcs + PHPstan #184

Merged
merged 7 commits into from
Apr 26, 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
35 changes: 35 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Continuous integration"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
generate-ci-matrix:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "10.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-ci-matrix.outputs.matrix) }}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "escalade"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
18 changes: 18 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset>
<file>.</file>
<exclude-pattern>/.git/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>

<arg name="colors" />
<arg name="extensions" value="php" />
<arg value="p" />
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
6 changes: 3 additions & 3 deletions ajax/assign_me.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");

if (! isset($_REQUEST['tickets_id'])) {
Html::displayErrorAndDie(__("missing parameters", "escalade"));
Html::displayErrorAndDie(__("missing parameters", "escalade"));
}

PluginEscaladeTicket::assign_me((int) $_REQUEST['tickets_id']);
PluginEscaladeTicket::assign_me((int) $_REQUEST['tickets_id']);
4 changes: 2 additions & 2 deletions ajax/central.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();

Session::checkLoginUser();

PluginEscaladeHistory::showCentralList();
PluginEscaladeHistory::showCentralList();
6 changes: 3 additions & 3 deletions ajax/cloneandlink_ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();

Session::checkLoginUser();

if (!isset($_REQUEST['tickets_id'])) {
exit;
exit;
}

PluginEscaladeTicket::cloneAndLink($_REQUEST['tickets_id']);
PluginEscaladeTicket::cloneAndLink($_REQUEST['tickets_id']);
6 changes: 3 additions & 3 deletions ajax/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();

Session::checkLoginUser();

if (!isset($_REQUEST['tickets_id'])) {
exit;
exit;
}

PluginEscaladeHistory::getHistory($_REQUEST['tickets_id']);
PluginEscaladeHistory::getHistory($_REQUEST['tickets_id']);
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.7"
"glpi-project/tools": "^0.7.2",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1",
"squizlabs/php_codesniffer": "^3.9"
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.4.0"
},
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
Loading