faktore/fe-skeleton-coding-standards

Defines a common set for coding standards

0.1.11 2024-03-26 21:12 UTC

This package is auto-updated.

Last update: 2024-05-26 21:33:36 UTC


README

Coding Standards (phpstan, php-cs-fixer, php_sniffer, github build)

Also provides a render-action ".github/workflows/ci.yml.example" which uses a simple CI pipeline, and posting to slack.

Requires you to set a SLACK_WEBHOOK_URL secret to point to your Slack App integration.

Usage

Install as a dev dependency:

composer require-dev faktore/fe-skeleton-coding-standards

Composer Scripts

Check out the file composer.scripts.json and place these in your existing composer.json project file.

The kickstarter in fe-skeleton-composer-templates also provides this.

(Required composer packages are not allowed to insert custom scripts, that is the reason it cannot be done for you automatically)

Provided files

When being used in fe-skeleton context, this provides the following files.

ONCE, only if not existing:

These files are only imported once, and only if such a file is NOT yet existing.

On skeleton updates these are meant to NOT overwrite these files, because it assumes that your project configures them.

This is what happens through the "dirmapOnce" composer.json configuration that the skeleton-composer-installer evaluates.

These files are meant to be versioned in your project repository.

  • phpstan-baseline.neon (project-specific baseline)

ALWAYS on updates:

These files will always be maintained in this repository, and every update to a new version will overwrite your files.

Your files are meant to be versioned in your project repository. If you plan to change things in these files, remove the "fe-skeleton-autogenerated" marker to do so.

Configuration

  • phpcs.xml (PHP_CodeSniffer config)
  • .php-cs-fixer.php (PHP-CS-Fixer config)
  • phpstan.neon (phpstan config)
  • .phpstorm.meta.php (PHPStorm helper)
  • phpstorm.inspections.xml (PHPStorm inspections)
  • .editorconfig
  • .github/workflows/ci.yml (Workflow)

Provided applications/code

A simple Symfony CLI Console Command is provided as:

  • vendor/faktore-git/fe-skeleton-coding-standards/Sniffy (inspection helper)

Reset script

rm phpcs.xml .php-cs-fixer.php phpstan.neon .phpstorm.meta.php phpstorm.inspections.xml .editorconfig .github/workflows/main.yml .github/workflows/ci.yml