Skip to content

Commit c294f7a

Browse files
Rom1-Bcedric-anne
andauthored
Feat(CI): add rector (#52)
* Feat(CI): add rector * fix * fix * try * review * cache * Update rector.php Co-authored-by: Cédric Anne <cedric.anne@gmail.com> * misc lint * Update rector.php --------- Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
1 parent 528640e commit c294f7a

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

plugin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ sed \
8787
-e "s/{UNAME}/$UNAME/g" \
8888
-e "s/{VERSION}/$VERSION/g" \
8989
-e "s/{YEAR}/$YEAR/g" \
90-
-i setup.php hook.php $LNAME.xml tools/HEADER README.md Makefile .github/workflows/continuous-integration.yml tests/bootstrap.php composer.json
90+
-i setup.php hook.php $LNAME.xml tools/HEADER README.md Makefile .github/workflows/continuous-integration.yml tests/bootstrap.php composer.json rector.php
9191

9292
# Unignore composer lock
9393
sed -i '/^[[:space:]]*composer\.lock[[:space:]]*$/d' .gitignore

rector.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/**
4+
* -------------------------------------------------------------------------
5+
* {NAME} plugin for GLPI
6+
* -------------------------------------------------------------------------
7+
*
8+
* MIT License
9+
*
10+
* Permission is hereby granted, free of charge, to any person obtaining a copy
11+
* of this software and associated documentation files (the "Software"), to deal
12+
* in the Software without restriction, including without limitation the rights
13+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* copies of the Software, and to permit persons to whom the Software is
15+
* furnished to do so, subject to the following conditions:
16+
*
17+
* The above copyright notice and this permission notice shall be included in all
18+
* copies or substantial portions of the Software.
19+
*
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
* SOFTWARE.
27+
* -------------------------------------------------------------------------
28+
* @copyright Copyright (C) {YEAR} by the {NAME} plugin team.
29+
* @license MIT https://opensource.org/licenses/mit-license.php
30+
* @link https://github.com/pluginsGLPI/{LNAME}
31+
* -------------------------------------------------------------------------
32+
*/
33+
34+
require_once __DIR__ . '/../../src/Plugin.php';
35+
36+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
37+
use Rector\Config\RectorConfig;
38+
use Rector\ValueObject\PhpVersion;
39+
40+
return RectorConfig::configure()
41+
->withPaths([
42+
__DIR__ . '/src',
43+
__DIR__ . '/tests',
44+
])
45+
->withPhpVersion(PhpVersion::PHP_82)
46+
->withCache(
47+
cacheDirectory: __DIR__ . '/var/rector',
48+
cacheClass: FileCacheStorage::class,
49+
)
50+
->withRootFiles()
51+
->withParallel(timeoutSeconds: 300)
52+
->withImportNames(removeUnusedImports: true)
53+
->withDeadCodeLevel(100)
54+
->withCodeQualityLevel(100)
55+
->withCodingStyleLevel(100)
56+
->withPhpSets(php82: true) // apply PHP sets up to PHP 8.2
57+
;

0 commit comments

Comments
 (0)