tightenco/duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.

Installs: 38 130

Dependents: 5

Suggesters: 0

Security: 0

Stars: 43

Watchers: 11

Forks: 2

Open Issues: 6

Type:project

v0.3.2 2021-08-20 15:23 UTC

README

Project Banner

Duster

Automatically apply Tighten's default code style for Laravel apps.

To achieve this, Duster installs and automatically configures the following tools:

  • TLint: Opinionated code linter for Laravel and PHP
    • using the default Tighten preset
  • PHP_CodeSniffer: catch issues that can't be fixed automatically
    • using the Tighten preset which is mostly PSR1 with some Tighten-specific rules
  • PHP CS Fixer: custom rules not supported by Laravel Pint
    • CustomOrderedClassElementsFixer Tighten-specific order of class elements
  • Pint: Laravel's code style rules (with a few Tighten specific customizations)
    • using the default Laravel preset with some Tighten-specific rules

Installation

You can install the package via composer:

composer require tightenco/duster --dev

Optionally you can publish a GitHub Actions linting config:

duster github-actions

Usage

To lint everything at once:

duster

To fix everything at once:

duster fix

To view all available commands:

duster help

Customizing

TLint

Create a tlint.json file in your project root. Learn more in the TLint documentation.

PHP_CodeSniffer

Create a .phpcs.xml.dist file in your project root with the following:

<?xml version="1.0"?>
<ruleset>
    <file>app</file>
    <file>config</file>
    <file>database</file>
    <file>public</file>
    <file>resources</file>
    <file>routes</file>
    <file>tests</file>

    <rule ref="Tighten"/>
</ruleset>

Now you can add customizations below the <rule ref="Tighten"/> line or even disable the Tighten rule and use your own ruleset. Learn more in this introductory article.

PHP CS Fixer

Create a .php-cs-fixer.dist.php file in your project root with the contents from Duster's .php-cs-fixer.dist.php file. Learn more in the PHP CS Fixer documentation.

Pint

Create a pint.json file in your project root, you can use Duster's pint.json file as a starting point. Learn more in the Pint documentation.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email hello@tighten.co instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.