Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't git commit image files because fail on tests:phpcs:sniff:files #2718

Closed
snize opened this issue Apr 6, 2018 · 2 comments
Closed

Can't git commit image files because fail on tests:phpcs:sniff:files #2718

snize opened this issue Apr 6, 2018 · 2 comments
Assignees
Labels
Bug Something isn't working

Comments

@snize
Copy link
Contributor

snize commented Apr 6, 2018

My system information:

  • Operating system type: macOS
  • Operating system version: 10.12.6
  • BLT version: 9.0.5
  • git version 2.16.3

This problem occurs in both existing projects and new projects. It did not occur when the blt version was 8.9.x

To reproduce this:

  1. composer create-project --no-interaction acquia/blt-project my-project
  2. cd my-project
  3. blt blt:init:git-hooks
  4. Then add any image file.

When I run this command:

git commit -m "commit image"

I get the following output:

Executing .git/hooks/pre-commit...
> tests:phpcs:sniff:files
Sniffing directories containing changed files...
[File\Write] Writing to /Users/snize/dev/my-project/tmp/phpcs-fileset.
[ExecStack] '/Users/snize/dev/my-project/vendor/bin/phpcs' --file-list='/Users/snize/dev/my-project/tmp/phpcs-fileset' --bootstrap='/Users/snize/dev/my-project/vendor/acquia/blt/src/Robo/Commands/Validate/phpcs-validate-files-bootstrap.php' -l
E


FILE: ...ze/dev/my-project/docroot/themes/custom/my_image.png
----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
 1 | WARNING | [ ] File has mixed line endings; this may cause
   |         |     incorrect results
 1 | WARNING | [ ] File encoding is invalid, expected UTF-8
 2 | ERROR   | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 260ms; Memory: 6Mb

[ExecStack]  Exit code 1
[CompletionWrapper]  Command `tests:phpcs:sniff:files 'docroot/themes/custom/my_image.png'` exited with code 1.
[CompletionWrapper]  Exit code 1
[error]

And I expected this to happen:

@grasmash grasmash added the Bug Something isn't working label Apr 10, 2018
@arknoll
Copy link
Contributor

arknoll commented Apr 11, 2018

@snize Just in case you are currently blocked while this is getting looked into. You can run:

git commit -m "commit image" -n

to skip any of the git hooks.

@snize
Copy link
Contributor Author

snize commented Apr 12, 2018

@arknoll Thanks for tips. I'm currently disabling git-hooks with https://blt.readthedocs.io/en/latest/readme/extending-blt/#git-hooks . Your way is better, as it can only skip git-hooks on certain commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants