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

Code style validation error when committing update from 9.2.0 to 9.2.1 #3207

Closed
ba66e77 opened this issue Nov 2, 2018 · 3 comments
Closed
Labels
Bug Something isn't working

Comments

@ba66e77
Copy link
Contributor

ba66e77 commented Nov 2, 2018

On an ACSF site, when committing the update from BLT 9.2.0 to 9.2.1, the post-commit hook raised code style violation errors from code in BLT's factory-hooks/post-install/post-install.php.

These had to be committed with --no-verify to get past the error.

 git commit -m "XXX-87: Update BLT to 9.2.1."
Executing .git/hooks/pre-commit...
> tests:phpcs:sniff:files
Sniffing directories containing changed files...
[File\Write] Writing to /Users/abhishek.anand/Sites/xxx/tmp/phpcs-fileset.
[ExecStack] '/Users/abhishek.anand/Sites/xxx/vendor/bin/phpcs' --file-list='/Users/abhishek.anand/Sites/xxx/tmp/phpcs-fileset' -l
E 1 / 1 (100%)
FILE: /Users/abhishek.anand/Sites/xxx/factory-hooks/post-install/post-install.php
---------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 61 ERRORS AND 6 WARNINGS AFFECTING 58 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------
  15 | ERROR   | [x] Additional blank lines found at end of doc comment
  17 | WARNING | [x] Unused use statement
  18 | WARNING | [x] Unused use statement
  19 | WARNING | [x] Unused use statement
  20 | WARNING | [x] Unused use statement
  22 | ERROR   | [ ] global variables should start with a single underscore followed by the module and another underscore
  33 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
  35 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 6
  36 | ERROR   | [x] Closing brace indented incorrectly; expected 3 spaces, found 4
  38 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  40 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  40 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
  41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  43 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  49 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  50 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  51 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  52 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  54 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  56 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  57 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  58 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  59 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  60 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  62 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  63 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  64 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
  65 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
  66 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 4
  67 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  68 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  69 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  70 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
  71 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  73 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  75 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
  75 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  75 | ERROR   | [x] No space found before comment text; expected "// $cache_directory = sprintf('/mnt/tmp/%s.%s/drush_tmp_cache/%s', $site, $env,
     |         |     md5($uri));" but found "//$cache_directory = sprintf('/mnt/tmp/%s.%s/drush_tmp_cache/%s', $site, $env, md5($uri));"
  76 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
  76 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  76 | ERROR   | [x] No space found before comment text; expected "// cacheDir=`/usr/bin/env php
     |         |     /mnt/www/html/$site.$env/vendor/acquia/blt/scripts/blt/drush/cache.php $site $env $uri`" but found "//cacheDir=`/usr/bin/env
     |         |     php /mnt/www/html/$site.$env/vendor/acquia/blt/scripts/blt/drush/cache.php $site $env $uri`"
  76 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
  77 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  79 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  81 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  81 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
  82 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  83 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  84 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  85 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  86 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  87 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  88 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 2
  89 | ERROR   | [x] Line indented incorrectly; expected at least 4 spaces, found 0
  90 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  92 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  93 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  94 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  95 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  95 | ERROR   | [ ] join() is a function name alias, use implode() instead
  97 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
  98 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
 100 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
 101 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
 102 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 2
 103 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
 103 | ERROR   | [x] Expected 1 newline at end of file; 3 found
---------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 63 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------
Time: 154ms; Memory: 8Mb
[ExecStack]  Exit code 2
[CompletionWrapper]  Command `tests:phpcs:sniff:files 'blt/.schema_version
composer.json
composer.lock
factory-hooks/db-update/db-update.sh
factory-hooks/post-install/post-install.php'` exited with code 2.
[CompletionWrapper]  Exit code 1
[error]
@ba66e77 ba66e77 added Bug Something isn't working acsf labels Nov 2, 2018
@wu-edward
Copy link

Looks like this is related to the PHPCS/Coder update to version 3.

The bootstrap file BLT was using before for PHPCS is incompatible with version 3. AFAIK, the bootstrap file would find the subset of committed files that were allowed by the phpcs.xml(.dist) file properties before sending the file list to be sniffed by PHPCS.

In my (limited) testing of PHPCS 3 with BLT, it seemed that the bootstrap file was unnecessary anyway, and that the functionality the bootstrap file provided was working out of the box in PHPCS 3.

It might be necessary to rewrite the bootstrap file for PHPCS 3, but the only guides/examples I've found are for the earlier versions.

@lcatlett lcatlett self-assigned this Nov 2, 2018
@lcatlett
Copy link
Contributor

lcatlett commented Nov 2, 2018

This also came up for other hooks/settings files because previously BLT excluded those directories. I'll put in a PR with the updated files to get builds passing and if we need a custom bootstrap in blt for PHPCS 3 then that can be a separate issue

This was referenced Nov 10, 2018
@lcatlett
Copy link
Contributor

fixed in #3231

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