-
Bug
-
Resolution: Fixed
-
Minor
-
3.11.11, 4.0.5, 4.1.1
I introduced per-repository phpcs configuration in MDL-74511
The order of loading of files is:
- .phpcs.xml
- phpcs.xml
- .phpcs.xml.dist
- phpcs.xml.dist
At the moment we have two files:
- .phpcs.xml.dist
- .phpcs.xml
The .phpcs.xml file generated by the grunt ignorefiles command is the most dominant of the possible configuration options and, as such, cannot be overridden by local configuration.
I woudl propose that we reduce the priority of these files so that it is possible for local rules to be applied (or alternative and complementary rulesets to be applied).
I suggest that we move:
- .phpcs.xml.dist to phpcs.xml.dist (the base ruleset definition)
- .phpcs.xml to phpcs.xml (the one generated by the ignorefiles)
This will allow people to use stricter standards, for example I have been writing a MoodleStrict standard for use in my own code which applies more opinionated preferences.
By making the proposed change, I can then create my own .phpcs.xml file with contents:
<?xml version="1.0" encoding="UTF-8"?>
|
<ruleset name="MoodleCore">
|
<rule ref="./phpcs.xml"/>
|
<rule ref="MoodleStrict"/>
|
</ruleset>
|
This configuration loads the configuration generated by grunt ignorefiles and further applies my own, stricter, configuration on top of it. That means that my end configuration is:
- moodle-cs
- ignored files
- MoodleStrict
- is a regression caused by
-
MDL-74511 Include .phpcs.xml with core
- Closed