Google Groups

Re: SilverStripe Coding Conventions and PHPCodesniffer

Ingo Schommer Sep 21, 2012 1:31 AM
Posted in group: SilverStripe Core Development
FREAKING AWESOME! I remember you showing me this when you were
still in Sweden, and I've had a todo item for "port Stig's codesniffer to new conventions" ever since heh.

We could hook into Travis, which would be the most visible automation.
But from what I can tell, we can't run the sniffer against diffs.
So for now, even if your changes are adhereing to the conventions,
but the file you changed is not, the sniffer will fail, right?

If that's the case, we need to fix up core first, which won't be a trivial exercise.
There's a project which might help with the basic bits:
Its written by the Symfony lead dev, and applied to Symfony code, so should be fairly solid.

That won't fix stuff like wrong class/method naming conventions of course,
of which we have plenty - those will be a slow deprecation cycle to fix. 
For any automation, we'd need to suppress those errors to keep the output meaningful.
Overall, I think the most useful mid-term application would be a diff of the sniffer error output,
which should be doable in CI (at least for TeamCity, not sure for Travis in terms of persistence).