tighten / duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.
MIT License
464 stars 13 forks source link

Custom rules? #113

Closed mohammed-alfarra closed 1 year ago

mohammed-alfarra commented 1 year ago

Is there any support nearby for add custom rules? Because I want to create new rule that can add missing type hints to functions and arguments like the ones that I was using in Rector

driftingly commented 1 year ago

Hi @mohammed-alfarra,

You can add custom PHP_CodeSniffer and PHP CS Fixer rules by providing a config for each tool.

https://github.com/tighten/duster#php_codesniffer https://github.com/tighten/duster#php-cs-fixer

You could also configure Duster to run Rector using the scripts key in the Duster config: https://github.com/tighten/duster#customizing

mohammed-alfarra commented 1 year ago

I tried to use Rector

.duster.json "scripts": { "fix": { "rector": ["./vendor/bin/rector", "process"] } }

But I always get this error image

driftingly commented 1 year ago

I just checked locally, and it's working for me. If you're on version 1.0 of Duster try upgrading to 2.0

TapanDerasari commented 1 year ago

I can confirm the same error in the terminal for the latest version too (2.0.1) while running the customize duster tool

image

driftingly commented 1 year ago

Thanks, I'll take another look.