.php-cs-fixer.dist.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. require_once './vendor-bin/cs-fixer/vendor/autoload.php';
  8. use Nextcloud\CodingStandard\Config;
  9. use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
  10. $config = new Config();
  11. $config
  12. ->setParallelConfig(ParallelConfigFactory::detect())
  13. ->getFinder()
  14. ->ignoreVCSIgnored(true)
  15. ->exclude('config')
  16. ->exclude('data')
  17. ->notPath('3rdparty')
  18. ->notPath('build/integration/vendor')
  19. ->notPath('build/lib')
  20. ->notPath('build/node_modules')
  21. ->notPath('build/stubs')
  22. ->notPath('composer')
  23. ->notPath('node_modules')
  24. ->notPath('vendor')
  25. ->in('apps')
  26. ->in(__DIR__);
  27. // Ignore additional app directories
  28. $rootDir = new \DirectoryIterator(__DIR__);
  29. foreach ($rootDir as $node) {
  30. if (str_starts_with($node->getFilename(), 'apps')) {
  31. $return = shell_exec('git check-ignore ' . escapeshellarg($node->getFilename() . '/'));
  32. if ($return !== null) {
  33. $config->getFinder()->exclude($node->getFilename());
  34. }
  35. }
  36. }
  37. return $config;