wp-enforcer icon indicating copy to clipboard operation
wp-enforcer copied to clipboard

Checker prevents adding image files to repo

Open morganestes opened this issue 6 years ago • 1 comments

Possibly related to #12, when I have WP Enforcer enabled, I'm prevented from adding images to my Git repo. PHPCS reports multiple errors, most noticeably "mixed line endings" and "ASP style opening tags" in the files. I have theInternal.NoCodeFound rule added but unless I also add an exclude-pattern for those files it still tries to check them, which is super frustrating.

This happens in my theme with screenshot.png and some JPEG images bundled with it.

morganestes avatar Aug 28 '17 19:08 morganestes

Something I've found lately has been that the logic surrounding "only check the files that are being staged for commit" is then causing files that would otherwise be ignored to be processed.

For example, pretend we're committing the following files:

  • index.php
  • functions.php
  • screenshot.png

Rather than running against the entire codebase, WP Enforcer would then pass those files to PHP_CodeSniffer, which can have some strange effects. Definitely something that can (and should) be addressed via the phpcs.xml file.

I'll dig into this, thanks for the report!

stevegrunwell avatar Sep 18 '17 15:09 stevegrunwell