2020-03-27 18:54:07 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2024-05-10 16:09:14 +03:00
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
*/
|
2022-01-06 16:19:06 +03:00
|
|
|
require_once './vendor-bin/cs-fixer/vendor/autoload.php';
|
2020-03-27 18:54:07 +03:00
|
|
|
|
|
|
|
use Nextcloud\CodingStandard\Config;
|
2024-06-24 11:40:15 +03:00
|
|
|
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
|
2020-03-27 18:54:07 +03:00
|
|
|
|
|
|
|
$config = new Config();
|
|
|
|
$config
|
2024-06-24 11:40:15 +03:00
|
|
|
->setParallelConfig(ParallelConfigFactory::detect())
|
2020-03-27 18:54:07 +03:00
|
|
|
->getFinder()
|
|
|
|
->exclude('config')
|
2024-08-25 21:40:47 +03:00
|
|
|
->exclude('3rdparty')
|
|
|
|
->exclude('build/stubs')
|
|
|
|
->exclude('composer')
|
2020-03-27 18:54:07 +03:00
|
|
|
->in(__DIR__);
|
2023-08-21 17:14:46 +03:00
|
|
|
|
2024-08-25 21:40:47 +03:00
|
|
|
$ignoredEntries = shell_exec('git status --porcelain --ignored ' . escapeshellarg(__DIR__));
|
|
|
|
$ignoredEntries = explode("\n", $ignoredEntries);
|
|
|
|
$ignoredEntries = array_filter($ignoredEntries, static fn (string $line) => str_starts_with($line, '!! '));
|
|
|
|
$ignoredEntries = array_map(static fn (string $line) => substr($line, 3), $ignoredEntries);
|
|
|
|
$ignoredEntries = array_values($ignoredEntries);
|
2023-08-21 17:14:46 +03:00
|
|
|
|
2024-08-25 21:40:47 +03:00
|
|
|
foreach ($ignoredEntries as $ignoredEntry) {
|
|
|
|
if (str_ends_with($ignoredEntry, '/')) {
|
|
|
|
$config->getFinder()->exclude($ignoredEntry);
|
|
|
|
} else {
|
|
|
|
$config->getFinder()->notPath($ignoredEntry);
|
2023-08-21 17:14:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-27 18:54:07 +03:00
|
|
|
return $config;
|