Glavin001/atom-beautify

Incorrect PHP indentation using Atom Beautify with PHP_CodeSniffer

Open

#2,361 创建于 2019年7月2日

在 GitHub 查看
 (5 评论) (0 反应) (1 负责人)CoffeeScript (1,503 star) (442 fork)batch import
help wantedquestionwaiting-for-user-information

描述

Description

Practically it seems that Atom Beautify fails to “see” my custom ruleset for PHP_CodeSniffer. When I launch it then I don’t get the same result I would get if I ran the command phpcbf --standard=phpcs.xml.dist 404.php.

Steps to Reproduce

  1. Add code to Atom editor
  2. Run command Atom Beautify: Beautify Editor
  3. This beautified code does not look right!

Debug

Here is a link to the debug.md Gist: https://gist.github.com/vizzale/acf39b8ceb659c575d8d8559cd6136a4

Checklist

I have:

  • Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
  • Reloaded (or restarted) Atom to ensure it is not a caching issue
  • Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues so I know this is not a duplicate issue
  • Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue

Extra

Here instead you find my configuration file phpcs.xml.dist:

<?xml version="1.0" encoding="UTF-8"?>

<ruleset name="WordPress Custom">
  <description>PHP_CodeSniffer custom ruleset: indentation with spaces</description>

  <arg name="tab-width" value="2"/>

  <rule ref="WordPress">
    <exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
  </rule>

  <rule ref="Generic.WhiteSpace.ScopeIndent">
    <properties>
      <property name="indent" value="2"/>
      <property name="exact" value="true"/>
      <property name="tabIndent" value="false"/>
      <property name="ignoreIndentationTokens" type="array">
        <element value="T_HEREDOC"/>
        <element value="T_NOWDOC"/>
      </property>
    </properties>
  </rule>

  <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>

  <rule ref="PEAR.Functions.FunctionCallSignature">
    <properties>
      <property name="indent" value="2"/>
    </properties>
  </rule>

  <rule ref="PSR2.ControlStructures.SwitchDeclaration">
    <properties>
      <property name="indent" value="2"/>
    </properties>
  </rule>
</ruleset>

贡献者指南