diff --git a/.github/workflows/code_checks.yaml b/.github/workflows/code_checks.yaml index 3de71ee63d..26507db86c 100644 --- a/.github/workflows/code_checks.yaml +++ b/.github/workflows/code_checks.yaml @@ -96,6 +96,27 @@ jobs: php build/box.phar info ../tmp/ecs.phar ../tmp/ecs.phar + cd .. + + # Deploy PHAR to https://github.com/Symplify/EasyCodingStandardPrefixed + # reuse tmp/rector.phar from previous job + git clone https://${ACCESS_TOKEN}@github.com/Symplify/EasyCodingStandardPrefixed.git > /dev/null 2>&1 + cp tmp/ecs.phar EasyCodingStandardPrefixed/ecs.phar + cp tmp/ecs.phar EasyCodingStandardPrefixed/ecs + cd EasyCodingStandardPrefixed + git config user.email "action@github.com" + git config user.name "Github Actions" + git add ecs ecs.phar + + if [ "${TRAVIS_TAG}" != "" ]; then COMMIT_MSG="ECS ${TRAVIS_TAG}"; else COMMIT_MSG="Updated ECS to commit ${TRAVIS_COMMIT}"; fi + + git commit -m "${COMMIT_MSG}" + git push --quiet origin master + + if [ "${TRAVIS_TAG}" != "" ]; then git tag "${TRAVIS_TAG}" && git push --quiet origin ${TRAVIS_TAG}; fi + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + binary_files: runs-on: ubuntu-latest diff --git a/ecs.yaml b/ecs.yaml index 15baa994dd..5c21d090fb 100644 --- a/ecs.yaml +++ b/ecs.yaml @@ -39,6 +39,8 @@ parameters: # tests - 'packages/*/tests/**Source/*.php' - 'packages/CodingStandard/tests/Fixer/Order/MethodOrderByTypeFixer/Wrong/*' + # own scope + - 'packages/EasyCodingStandard/compiler/build/scoper.inc.php' skip: # run form time to time, very slow and making many changes diff --git a/packages/EasyCodingStandard/README.md b/packages/EasyCodingStandard/README.md index 35b6023c64..2e2a741969 100644 --- a/packages/EasyCodingStandard/README.md +++ b/packages/EasyCodingStandard/README.md @@ -11,7 +11,7 @@ - +
@@ -23,6 +23,7 @@ - **2nd run under few seconds** with caching - [Skipping files](#ignore-what-you-cant-fix) for specific checkers - [Prepared checker sets](#use-prepared-checker-sets) - PSR12, Symfony, Common, Symplify and more... +- Use [Prefixed version](https://github.com/Symplify/EasyCodingStandardPrefixed) to prevent conflicts on install Are you already using another tool? diff --git a/packages/EasyCodingStandard/bin/ecs b/packages/EasyCodingStandard/bin/ecs index 3f3aca788c..420284ce73 100755 --- a/packages/EasyCodingStandard/bin/ecs +++ b/packages/EasyCodingStandard/bin/ecs @@ -38,7 +38,7 @@ if ($inputConfig) { } // 2. --set CLI option -$setInputConfig = $configResolver->resolveSetFromInputAndDirectory($input, __DIR__ . '/../config/set'); +$setInputConfig = $configResolver->resolveSetFromInputAndDirectory($input, Set::SET_DIRECTORY); if ($setInputConfig) { $configs[] = $setInputConfig; } @@ -178,7 +178,7 @@ final class AutoloadIncluder return; } - require_once $phpCodeSnifferAutoload; + $this->loadIfNotLoadedYet($phpCodeSnifferAutoload, __METHOD__ . '()" on line ' . __LINE__); // initalize PHPCS tokens new Tokens(); diff --git a/packages/EasyCodingStandard/compiler/bin/compile b/packages/EasyCodingStandard/compiler/bin/compile index e0958d32ae..28df674a4f 100755 --- a/packages/EasyCodingStandard/compiler/bin/compile +++ b/packages/EasyCodingStandard/compiler/bin/compile @@ -7,7 +7,7 @@ use Symplify\EasyCodingStandard\Compiler\Console\CompileCommand; use Symplify\EasyCodingStandard\Compiler\Process\CompileProcessFactory; use Symfony\Component\Console\Application; -// use monorepo autoload.php +// use EasyCodingStandard package autoload.php require_once __DIR__ . '/../vendor/autoload.php'; $compileCommand = new CompileCommand( diff --git a/packages/EasyCodingStandard/compiler/build/box.phar b/packages/EasyCodingStandard/compiler/build/box.phar old mode 100644 new mode 100755 diff --git a/packages/EasyCodingStandard/compiler/build/scoper.inc.php b/packages/EasyCodingStandard/compiler/build/scoper.inc.php index 8357ece4d9..1f434de1ee 100644 --- a/packages/EasyCodingStandard/compiler/build/scoper.inc.php +++ b/packages/EasyCodingStandard/compiler/build/scoper.inc.php @@ -15,5 +15,8 @@ function (string $filePath, string $prefix, string $content): string { return str_replace('__DIR__ . \'/..', '\'phar://ecs.phar', $content); }, ], - 'whitelist' => ['Symplify\*', 'PHP_CodeSniffer\*', 'PhpCsFixer\*'], + 'whitelist' => [ + // needed for autoload, that is not prefixed, since it's in bin/* file + 'Symplify\*', + ], ];