laravel / pint

Laravel Pint is an opinionated PHP code style fixer for minimalists.

Home Page:https://laravel.com/docs/pint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: multiple configuration files

TorstenDittmann opened this issue Β· comments

In an organization we can be using a global configuration for pint and use it as a composer dependency and we would be using it like this:

pint --config vendor/my-company/coding-style/pint.json

Now some repositories where this is consumed, might need to add configuration on top, like exclude, notPath or notName.

Scenario:

  • Have a global configuration file with some rules.
  • Consume it via composer in multiple repositories
  • Needing to exclude some paths relevant to some repositories on top of the global configuration

I can see 2 approaches on how to solve it:

  1. pint.json can take a file path in preset or add a new extends value. Downside is, this could lead into a recursion hell and therefore also with a more complex implementation.
  2. Allow passing multiple --config xxx.json arguments and merge the configurations by order. Like pint --config vendor/my-company/coding-style/pint.json --config pint.json.

I wouldn't mind working on this feature and can provide a PR πŸ‘πŸ»

PS: Created a draft PR for the second approach at #175.

Thank you for submitting this feature proposal for Pint. Unfortunately, at this time, we do not have plans to add this feature to Pint.

Thank you for submitting this feature proposal for Pint. Unfortunately, at this time, we do not have plans to add this feature to Pint.

What would be the recommended steps to achieve this use-case? πŸ™‚

This kinda blocks us from implementing such a global ruleset to our ~50 PHP repositories πŸ‘πŸ»

I would also want a global base config file. I get that for collaborative projects it's a good idea to commit the Pint config file, but I also use the global version locally on a lot of random projects that might not be committed to VCS and where it would just make more sense to just have a local base config.