WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
270 stars 3 forks source link

Allow custom rulesets #91

Open justintadlock opened 6 years ago

justintadlock commented 6 years ago

I saw this briefly mentioned in another ticket but thought it'd best to bring up as a standalone ticket.

It'd be awesome if theme authors could define their own rulesets for use with the plugin. Having a way to filter something like theme_sniffer_get_standards() would be great (would probably want that function to define everything about a standard, including pointing to its XML file).

dingo-d commented 5 years ago

One thing that maybe could be done is to have the composer.json and .lock file in the bundled plugin, and then if a theme author wants to extend it, he/she would just add their standard using composer. That way the standard would be added to the list of the existing standards.

The tricky part if working without composer is fixing all the installed paths in the phpcs.

I've already added a filter, but haven't tested it: https://github.com/WPTRT/theme-sniffer/blob/feature/use-namespace/src/helpers/sniffer-helpers-trait.php#L61-L63