Skip to content

Commit 06c9011

Browse files
authored
Feature/ci (#54)
* Add CI * phpcbf * visibility * phpstan lvl 0 * phpstan lvl 1 * phpstan lvl 5 * Move external lib * Remove empty file
1 parent 064d1fe commit 06c9011

18 files changed

+1207
-894
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Continuous integration"
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
tags:
8+
- "*"
9+
pull_request:
10+
schedule:
11+
- cron: "0 0 * * *"
12+
workflow_dispatch:
13+
14+
jobs:
15+
ci:
16+
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"}
22+
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"}
23+
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"}
24+
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"}
25+
- {glpi-version: "10.0.x", php-version: "8.3-rc", db-image: "mysql:8.0"}
26+
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
27+
with:
28+
plugin-key: "treeview"
29+
glpi-version: "${{ matrix.glpi-version }}"
30+
php-version: "${{ matrix.php-version }}"
31+
db-image: "${{ matrix.db-image }}"

.phpcs.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<file>.</file>
4+
<exclude-pattern>/.git/</exclude-pattern>
5+
<exclude-pattern type="relative">^vendor/</exclude-pattern>
6+
7+
<arg name="colors" />
8+
<arg name="extensions" value="php" />
9+
<arg value="p" />
10+
<arg name="warning-severity" value="0" />
11+
12+
<rule ref="PSR12">
13+
<exclude name="Generic.Files.LineLength" />
14+
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
15+
</rule>
16+
<rule ref="Generic.Arrays.ArrayIndent"></rule>
17+
</ruleset>

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"php": ">=7.4"
44
},
55
"require-dev": {
6-
"glpi-project/tools": "^0.6"
6+
"glpi-project/tools": "^0.7.1",
7+
"php-parallel-lint/php-parallel-lint": "^1.3",
8+
"phpstan/phpstan": "^1.10",
9+
"squizlabs/php_codesniffer": "^3.7"
710
},
811
"config": {
912
"optimize-autoloader": true,

composer.lock

+188-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/config.form.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
* -------------------------------------------------------------------------
2929
*/
3030

31-
include ('../../../inc/includes.php');
31+
include('../../../inc/includes.php');
3232

3333

3434
$config = new PluginTreeviewConfig();
3535
if (isset($_POST["update"])) {
36-
$config->update($_POST);
37-
Html::back();
36+
$config->update($_POST);
37+
Html::back();
3838
} else {
39-
if (Plugin::isPluginActive("treeview")) {
40-
Html::header(PluginTreeviewConfig::getTypeName(), $_SERVER['PHP_SELF'], "config", "plugin");
41-
$config->showForm(1);
42-
} else {
43-
Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugin");
44-
// Get the configuration from the database and show it
45-
echo " <script type='text/javascript'>
39+
if (Plugin::isPluginActive("treeview")) {
40+
Html::header(PluginTreeviewConfig::getTypeName(), $_SERVER['PHP_SELF'], "config", "plugin");
41+
$config->showForm(1);
42+
} else {
43+
Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugin");
44+
// Get the configuration from the database and show it
45+
echo " <script type='text/javascript'>
4646
if (top != self)
4747
top.location = self.location;
4848
</script>";
49-
}
49+
}
5050
}
5151

5252
Html::footer();

front/preference.form.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
* -------------------------------------------------------------------------
2929
*/
3030

31-
include ('../../../inc/includes.php');
31+
include('../../../inc/includes.php');
3232

3333
$pref = new PluginTreeviewPreference();
3434

3535
//Save user preferences
3636
if (isset($_POST['plugin_treeview_user_preferences_save'])) {
37-
$pref->update($_POST);
38-
Html::back();
39-
}
37+
$pref->update($_POST);
38+
Html::back();
39+
}

front/preference.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
* -------------------------------------------------------------------------
2929
*/
3030

31-
include ('../../../inc/includes.php');
31+
include('../../../inc/includes.php');
3232

3333
if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
34-
Html::header("TITRE", $_SERVER['PHP_SELF'], "plugins", "pluginexampleexample", "");
34+
Html::header("TITRE", $_SERVER['PHP_SELF'], "plugins", "pluginexampleexample", "");
3535
} else {
36-
Html::helpHeader("TITRE", $_SERVER['PHP_SELF']);
36+
Html::helpHeader("TITRE", $_SERVER['PHP_SELF']);
3737
}
3838

3939
//checkTypeRight('PluginExampleExample',"r");
4040

4141
Search::show('PluginExampleExample');
4242

43-
Html::footer();
43+
Html::footer();

0 commit comments

Comments
 (0)