Answers.Body: <p>The phpcs/phpcbf standard in use is a modified Drupal standard, so you call the standard of "Drupal":
  <code>
  phpcbf --standard="Drupal" filename.php
  </code>
  However, if you ALSO have unmodified copies of the Drupal standard installed, the trick is to make sure that you're calling the correct version of phpcbf.  For instance, I get this:
  <code>
  mycomputer» which phpcbf
  /home/jon/local/civicrm-buildkit/bin/phpcbf
  </code>
  If your default phpcbf isn't the one installed with <code>civicrm-buildkit</code>, make sure to specify the full path to the one that is.</p>
  
  <p>If that doesn't work:
  <code>civilint</code> is a script.  So you can edit it in a text editor.  In the latest version, line 179 reads:
  <code>
  xargs $BINDIR/phpcs --standard="$PHPCS_STD" &lt; "$TMP/php.txt"
  </code>
  Add an "echo" into it like so:
  <code>
  xargs echo $BINDIR/phpcs --standard="$PHPCS_STD" &lt; "$TMP/php.txt"
  </code></p>
  
  <p>Run civilint again:
  <code>
  civilint myfile.php
  </code>
  Instead of outputting the result of <code>phpcs</code> it should instead show the command it WOULD have run.  In my case, it's:
  <code>
  /home/jon/local/civicrm-buildkit/bin/phpcs --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php
  </code></p>
  
  <p>Change <code>phpcs</code> to <code>phpcbf</code> and run that command:
  <code>
  /home/jon/local/civicrm-buildkit/bin/phpcbf --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php
  </code></p>
  
  <p><strong>Note</strong> Don't forget to remove the <code>echo</code> when you're done!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-06T15:48:54.417Z
Answers.Text: I get "ERROR: the "Drupal" coding standard is not installed. The installed coding standards are PHPCS, Zend, PSR1, PSR2, PEAR, MySource and Squiz" on buildkit vagrant which a civilint which definitely works.
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-06T22:38:48.680Z
Answers.Text: @JohnFF I edited my answer to give more details.  Hopefully this fixes things for you. If you're still having trouble, please post details!
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-08T00:09:57.457Z
Answers.Text: Thanks Jon. Why not wrap it up for us? CiviCbf? "Patch Welcome!" as Xavi says...
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-10T04:24:49.947Z
Answers.Text: To be honest, I don't use it!  My IDE (Netbeans) fixes the vast majority of these issues for me.  I happened to use `phpcbf` once and only once the day before I saw this.  I was curious how it could possibly auto-fix a particular issue.  I don't imagine I'll use it again for Civi.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-05T21:58:01.263Z
Answers.LastActivityDate: 2017-05-06T22:38:17.190Z
Answers.LastEditDate: 2017-05-06T22:38:17.190Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>One use of <code>phpcbf</code> is as a way to automatically format (or'beautify' the code you write in your editor (providing your editor supports it).</p>
  
  <p>For example, Atom supports <code>phpcbf</code> via the <a href="https://atom.io/packages/beautify" rel="nofollow noreferrer">beautify</a> package.</p>
  
  <p>Buildkit provides a wrapper (or two) around <code>phpcbf</code> set up with appropriate defaults. You can find it in the civicrm-buildkit/bin directory. Specifying that your editor use this file will ensure that your code is 'beautified` the CiviWay.</p>
  
  <p>In my case, I set the phpcbf executable to be <code>/home/michael/src/civicrm-buildkit/bin/phpcbf-civi</code> in Atom's <em>Settings > Packages > Atom Beautify > Executables</em>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-21T11:19:12.393Z
Answers.LastActivityDate: 2018-02-21T11:19:12.393Z
Answers.UserDisplayName: michaelmcandrew
Answers.Body: <p>fixing code automatically is hard, and can break things indeed.</p>
  
  <p>I'm assuming you ran this one? </p>
  
  <p><a href="https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically" rel="nofollow noreferrer">https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically</a></p>
  
  <p>if you git diff the file you "fixed", what did you see?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-07T23:48:22.290Z
Answers.Text: heya Xavier! I ran `phpcs /path/to/file` and it made a huge mess of the file - it looks like it needs to point to a config file but I couldn't figure it out!
Answers.UserDisplayName: ErichBSchulz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-07T22:20:08.797Z
Answers.LastActivityDate: 2017-03-07T22:20:08.797Z
Answers.UserDisplayName: Xavier
Body: <p>When I run civilint in the build kit I get a long report which ends with this line:</p>
  
  <p><code>PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
  </code></p>
  
  <p>Well that sounds great! Where is this mythical <code>phpcbf</code> and how do I use it?</p>
  
  <p>When I ran it with just the name of the file it really broke things!!</p>
  
Tags: <php><coding-standards>
Title: how do I use phpcbf?
ThreadText: # how do I use phpcbf?
  
  (Asked by: username_0 on 2017-03-03)
  
  When I run civilint in the build kit I get a long report which ends with this line:
  
  `PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY`
  
  Well that sounds great! Where is this mythical `phpcbf` and how do I use it?
  
  When I ran it with just the name of the file it really broke things!!
  
  **Tags:** php, coding-standards
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2017-05-05. Score: 3
  
  The phpcs/phpcbf standard in use is a modified Drupal standard, so you call the standard of "Drupal":
  `phpcbf --standard="Drupal" filename.php`
  However, if you ALSO have unmodified copies of the Drupal standard installed, the trick is to make sure that you're calling the correct version of phpcbf. For instance, I get this:
  `mycomputer» which phpcbf
  /home/jon/local/civicrm-buildkit/bin/phpcbf`
  If your default phpcbf isn't the one installed with `civicrm-buildkit`, make sure to specify the full path to the one that is.
  
  If that doesn't work:
  `civilint` is a script. So you can edit it in a text editor. In the latest version, line 179 reads:
  `xargs $BINDIR/phpcs --standard="$PHPCS_STD" < "$TMP/php.txt"`
  Add an "echo" into it like so:
  `xargs echo $BINDIR/phpcs --standard="$PHPCS_STD" < "$TMP/php.txt"`
  
  Run civilint again:
  `civilint myfile.php`
  Instead of outputting the result of `phpcs` it should instead show the command it WOULD have run. In my case, it's:
  `/home/jon/local/civicrm-buildkit/bin/phpcs --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php`
  
  Change `phpcs` to `phpcbf` and run that command:
  `/home/jon/local/civicrm-buildkit/bin/phpcbf --standard=/home/jon/local/civicrm-buildkit/vendor/drupal/coder/coder_sniffer/Drupal fastactionlinks.php`
  
  **Note** Don't forget to remove the `echo` when you're done!
  
  > **Comments:**
  > **username_2**: I get "ERROR: the "Drupal" coding standard is not installed. The installed coding standards are PHPCS, Zend, PSR1, PSR2, PEAR, MySource and Squiz" on buildkit vagrant which a civilint which definitely works.  
  > **username_1**: @username_2 I edited my answer to give more details.  Hopefully this fixes things for you. If you're still having trouble, please post details!  
  > **username_2**: Thanks Jon. Why not wrap it up for us? CiviCbf? "Patch Welcome!" as Xavi says...  
  > **username_1**: To be honest, I don't use it!  My IDE (Netbeans) fixes the vast majority of these issues for me.  I happened to use `phpcbf` once and only once the day before I saw this.  I was curious how it could possibly auto-fix a particular issue.  I don't imagine I'll use it again for Civi.  
  
  ---
  
  ### Answer by username_3 on 2018-02-21. Score: 1
  
  One use of `phpcbf` is as a way to automatically format (or'beautify' the code you write in your editor (providing your editor supports it).
  
  For example, Atom supports `phpcbf` via the [beautify](https://atom.io/packages/beautify) package.
  
  Buildkit provides a wrapper (or two) around `phpcbf` set up with appropriate defaults. You can find it in the civicrm-buildkit/bin directory. Specifying that your editor use this file will ensure that your code is 'beautified` the CiviWay.
  
  In my case, I set the phpcbf executable to be `/home/michael/src/civicrm-buildkit/bin/phpcbf-civi` in Atom's *Settings > Packages > Atom Beautify > Executables*.
  
  
  ---
  
  ### Answer by username_4 on 2017-03-07. Score: 0
  
  fixing code automatically is hard, and can break things indeed.
  
  I'm assuming you ran this one?
  
  <https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically>
  
  if you git diff the file you "fixed", what did you see?
  
  > **Comments:**
  > **username_0**: heya username_4! I ran `phpcs /path/to/file` and it made a huge mess of the file - it looks like it needs to point to a config file but I couldn't figure it out!  
  
  ---
  
  