User Story:
As a user managing multiple Laravel projects, I want a centralized way to handle custom code styles across all projects, while retaining the flexibility to customize styles on a per-project basis.
Problem:
Currently, the only way to load a different configuration is either from a local path or via HTTP, as demonstrated in the documentation:
pint --config vendor/my-company/coding-style/pint.json
pint --config https://my.site.com/pint.json (undocumented but seems to work)
However, this approach has limitations. For instance, certain configurations like 'exclude' and 'notName' are defined in the pint.json file, potentially varying between projects. Consequently, users may need to manually copy and edit the pint.json file for each project. This becomes problematic when the code style updates, necessitating manual adjustments once again. Additionally, enabling or disabling a rule on a project level requires the same manual process.
Proposed Solution:
Enable the loading of presets over HTTP. This would allow users to manage all rules in one central location, such as a URL (e.g., https://pastebin.com/raw/N5TfqWZw), while still allowing for project-specific adjustments.
In this example, all rules from the specified URL would be loaded, with the additional capability to disable specific rules and exclude paths on a per-project basis.
Benefits:
With this approach, all rules are centrally managed at a designated URL (e.g., https://pastebin.com/raw/N5TfqWZw), simplifying updates and maintenance. Simultaneously, users retain the ability to fine-tune configurations for individual projects.
To implement this feature, two changes are required. First, presets should be in JSON format. Secondly, the ConfigurationResolverFactory should be enhanced to load presets over HTTP.
User Story: As a user managing multiple Laravel projects, I want a centralized way to handle custom code styles across all projects, while retaining the flexibility to customize styles on a per-project basis.
Problem: Currently, the only way to load a different configuration is either from a local path or via HTTP, as demonstrated in the documentation:
However, this approach has limitations. For instance, certain configurations like 'exclude' and 'notName' are defined in the pint.json file, potentially varying between projects. Consequently, users may need to manually copy and edit the pint.json file for each project. This becomes problematic when the code style updates, necessitating manual adjustments once again. Additionally, enabling or disabling a rule on a project level requires the same manual process.
Proposed Solution: Enable the loading of presets over HTTP. This would allow users to manage all rules in one central location, such as a URL (e.g., https://pastebin.com/raw/N5TfqWZw), while still allowing for project-specific adjustments.
Example Configuration:
In this example, all rules from the specified URL would be loaded, with the additional capability to disable specific rules and exclude paths on a per-project basis.
Benefits: With this approach, all rules are centrally managed at a designated URL (e.g., https://pastebin.com/raw/N5TfqWZw), simplifying updates and maintenance. Simultaneously, users retain the ability to fine-tune configurations for individual projects.
Additional Information:
Related Issues:
Issue #247: Enables third-party hosting of presets. Issue #199: Allows users to "pin" presets, for example, with a URL like https://raw.githubusercontent.com/laravel/pint/v1.13.4/resources/presets/laravel.json.
Proposed Code Changes:
To implement this feature, two changes are required. First, presets should be in JSON format. Secondly, the ConfigurationResolverFactory should be enhanced to load presets over HTTP.
View the proposed changes in the fork at https://github.com/maantje/pint/commit/6ed0ca9d583d51424936f5f06f9cc85ae57c83db