1

Im trying to implement PHPCS in my project which has an huge technical depth. I have for example one module with 378 sniffs (both errors and warnings combined). However the fact is that i also have like 29 modules which makes it nearly impossible to finish this technical depth in a short period of time.

What i want is to keep it at least stable so that one of the teams can keep developing where the other can clean up some mess on the spot. The question is how can i enable PHPCS scans but for example let if only fail when it hits more than 378 hits in this case on that module. This way i can ensure that my depth stays the same and a long the way i can ensure that it will be lowered.

As far as i can see the only way with PHPCS itself is to set the severity levels and let it break on there but i'd rather stay as close as possible to the default coding standards and keep it as strict as possible.

Thanks a lot

Pim

Dirkos
  • 488
  • 1
  • 10
  • 33
  • 1
    You don't say what you're doing with the result, but I'm assuming something like a build tool or pre-commit check. In these cases, you might want to skip checking the exit code and instead ask PHPCS to give you a report like CSV/XML/JSON - something you can use to easily pull out the total number of errors for the run (or per file). Then use that data to decide if you want to fail the run or not. Maybe wrap PHPCS in your own script so you can control the exit code. – Greg Sherwood Nov 14 '17 at 23:33

1 Answers1

1

I build an own script like Greg above also mentioned that checks the outcome of the --report=summary via a regex. The regex outcome then determines the exit code 0 or 1 from there.

Would be helpfull if PHPCS could do something like that itself but its not there

Dirkos
  • 488
  • 1
  • 10
  • 33