phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 431 forks source link

Multiple configuration files with local overriding #499

Closed mgeoffray closed 6 years ago

mgeoffray commented 6 years ago
Q A
Version
Bug? no
New feature? no
Question? yes
Documentation?
Related tickets comma-separated list of related tickets

Hi, I would like to know if it is possible to have multiple config files?

Multiple projects with the same grumphp.yml configuration file but I would like to make a project specific config file overriding the default one.

Something like that:

Project A / Project B / Project C have the same config file grumphp.yml

parameters:
    stop_on_failure: true
    ascii:
        failed: ~
        succeeded: ~
    tasks:
        git_blacklist:
            keywords:
                - "die;"
            triggered_by: [php]

I would like to change config for Project A grumphp.local.yml

parameters:
    tasks:
        git_blacklist:
            keywords:
                - "die;"
                - "var_dump"

The idea behind this is to have a common configuration for all project with the possibility to override configuration project by project with a second file, for example grumphp.local.yml

veewee commented 6 years ago

You are probably looking for the conventions documentation? https://github.com/phpro/grumphp/blob/master/doc/conventions.md

There are some limitations to this approach, like e.g. adding tasks. This could be handled with an extension instead: https://github.com/phpro/grumphp/blob/master/doc/extensions.md

Tip: use variables everywhere. This way you can easily overwrite the configuration per project.

mattheo-geoffray commented 6 years ago

Hi @veewee , perfect this is exactly what I am looking for! Thank you for your quick answer!