Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pint, PHP-CS-Fixer, and reconfigure #43

Merged
merged 12 commits into from
Oct 18, 2022

Conversation

driftingly
Copy link
Member

@driftingly driftingly commented Oct 4, 2022

This PR moves Duster's coding standards away from Tighten Coding Standard and introduces Laravel Pint.

Laravel Pint has appeared as the de facto standard for code style and fixes for the Laravel community. We extend Pint's Laravel preset to add some Tighten-specific rules.

Since Pint is built around rules that can be automatically fixed, we'll still rely on PHP_CodeSniffer to catch issues that require manual intervention. Most of these come from PSR1.

This PR also relies on a custom PHP-CS-Fixer rule to order class elements. This can be removed as soon as this PR from @bakerkretzmar is merged or Pint allows additional customizations.

Notable Changes

The duster init command is no longer required. Duster will use any config files if they exist but will fall back to passing Duster's own config file.

To replace generating GitHub Actions via the init command a new github-actions command has been added.

Duster now accepts path arguments which can be passed in when using Duster with Husky and lint-staged:

duster app/Http/Controllers/UserController.php app/Http/Controllers/Controller.php

Supplied paths with a specific tool:

duster tlint app/Http/Controllers/UserController.php app/Http/Controllers/Controller.php

The GitHub action stub now runs duster instead of each tool separately.

The help command received colours:

help


Once merged it will deprecate Tighten Coding Standard and allows TLint to focus on things these tools cannot do.

Closes tighten/tlint#294
Closes tighten/tlint#290
Closes tighten/tlint#280
Closes tighten/tlint#161

@driftingly driftingly marked this pull request as ready for review October 4, 2022 17:53
@driftingly driftingly changed the title [WIP] Add Pint and PHP-CS-Fixer and reconfigure Add Pint and PHP-CS-Fixer and reconfigure Oct 4, 2022
@driftingly driftingly changed the title Add Pint and PHP-CS-Fixer and reconfigure Add Pint, PHP-CS-Fixer, and reconfigure Oct 4, 2022
Copy link
Contributor

@sbine sbine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 👍 from me as soon as the one suggestion is addressed

standards/Tighten/ruleset.xml Outdated Show resolved Hide resolved
@driftingly driftingly merged commit 159f397 into main Oct 18, 2022
@driftingly driftingly deleted the adc/update-standards-tooling branch October 18, 2022 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants