From 24772f856f8d7289957cda56b0f29ac3971c29cf Mon Sep 17 00:00:00 2001 From: jekkos Date: Fri, 10 May 2024 00:42:39 +0200 Subject: [PATCH] Remove action for userguide (#3708) --- .github/workflows/main.yml | 61 --------------------- .github/workflows/test-coding-standards.yml | 6 -- .php-cs-fixer.no-header.php | 48 ++++++++++++++++ 3 files changed, 48 insertions(+), 67 deletions(-) delete mode 100644 .github/workflows/main.yml create mode 100644 .php-cs-fixer.no-header.php diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index de3090812..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Coding Standards - -on: - push: - paths: - - '**.php' - - 'spark' - - '.github/workflows/test-coding-standards.yml' - pull_request: - paths: - - '**.php' - - 'spark' - - '.github/workflows/test-coding-standards.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - lint: - name: PHP ${{ matrix.php-version }} Lint with PHP CS Fixer - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - php-version: - - '7.4' - - '8.0' - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: tokenizer - coverage: none - - - name: Get composer cache directory - run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.php-version }}- - ${{ runner.os }}- - - - name: Install dependencies - run: composer update --ansi --no-interaction - - - name: Run lint on `app/`, `public/` - run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.no-header.php --using-cache=no --diff diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index 7e5f18820..b981308e4 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -60,11 +60,5 @@ jobs: - name: Run lint on `app/`, `admin/`, `public/` run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.no-header.php --using-cache=no --diff - - name: Run lint on `system/`, `utils/`, and root PHP files - run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff - - name: Run lint on `tests` run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.tests.php --using-cache=no --diff - - - name: Run lint on `user_guide_src/source/` - run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.user-guide.php --using-cache=no --diff diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php new file mode 100644 index 000000000..e7d9647e3 --- /dev/null +++ b/.php-cs-fixer.no-header.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use CodeIgniter\CodingStandard\CodeIgniter4; +use Nexus\CsConfig\Factory; +use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer; +use Nexus\CsConfig\FixerGenerator; +use PhpCsFixer\Finder; + +$finder = Finder::create() + ->files() + ->in([ + __DIR__ . '/admin', + __DIR__ . '/app', + __DIR__ . '/public', + ]) + ->exclude(['Views/errors/html']) + ->append([ + __DIR__ . '/admin/starter/builds', + ]); + +$overrides = [ + // for updating to coding-standard + 'modernize_strpos' => true, + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], + 'php_unit_attributes' => true, +]; + +$options = [ + 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', + 'finder' => $finder, + 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), + 'customRules' => [ + NoCodeSeparatorCommentFixer::name() => true, + ], +]; + +return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();