-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
49 lines (44 loc) · 1.3 KB
/
.php-cs-fixer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->name('*.php')
->name('_ide_helper')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
->notPath([
'cache',
'cypress',
'dbscripts',
'docs',
'js',
'lib/pkp',
'lib/ui-library',
'locale',
'node_modules',
'public',
'registry',
'schemas',
'styles',
'templates',
]);
// Apply formatting to all plugins that are not git submodules
$pluginsDir = __DIR__ . '/plugins';
$files = scandir($pluginsDir);
foreach ($files as $file) {
$categoryDir = "$pluginsDir/$file";
if (!in_array($file, ['.', '..']) && is_dir($categoryDir)) {
$pluginDirs = scandir($categoryDir);
foreach ($pluginDirs as $pluginDir) {
$fullPluginPath = join('/', [$categoryDir, $pluginDir]);
$gitPath = join('/', [$fullPluginPath, '.git']);
if (!in_array($pluginDir, ['.', '..']) && is_dir($fullPluginPath) && file_exists($gitPath)) {
$finder->notPath(str_replace(__DIR__ . '/', '', $fullPluginPath));
}
}
}
}
$rules = include './lib/pkp/.php_cs_rules';
$config = new PhpCsFixer\Config();
return $config->setRules($rules)
->setFinder($finder);