laravel/pint

Exclude Specific Rule of Laravel Pint in a Folder or File

WeedTest opened this issue · 1 comments

Description:
I would like to request the ability to exclude a specific rule of Laravel Pint in a specified folder or file. This feature would allow other rules to be applied to the path, while the excluded rule is specified in the configuration.

Use Case:

  • Developers who need to adhere to different coding standards in specific parts of a project.
  • Projects that have legacy code or third-party integrations that should not be refactored to comply with certain rules.
  • Improving flexibility and control over the code quality and formatting rules applied to different parts of the project.

Proposed Solution:

  • Introduce a configuration option in pint.json or pint.yml that allows specifying exclusions for particular files or directories.
  • Implement a mechanism to override specific rules in designated paths while keeping other rules active.

Steps to Reproduce:

  1. Configure Laravel Pint with a set of rules in pint.json.
  2. Specify a folder or file where one of the rules should be excluded.
  3. Run Laravel Pint and observe that all rules except the excluded one are applied to the specified path.

Example Configuration:

{
    "preset": "laravel",
    "exclude": {
        "rules": [
            "some-specific-rule"
        ],
        "paths": [
            "path/to/excluded-folder",
            "path/to/excluded-file.php"
        ]
    }
}

Benefits:

  • Enhances the flexibility of code quality enforcement.
  • Reduces the need for manual rule management.
  • Provides a more maintainable approach for large projects with varying coding standards.

Thanks. Right now we're not planning on this sorry but you can always attempt a PR if you want to.