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

How to autoload committed files if custom xml is presented? #25

Open
MDaskalovAtBE opened this issue Jan 29, 2020 · 0 comments
Open

How to autoload committed files if custom xml is presented? #25

MDaskalovAtBE opened this issue Jan 29, 2020 · 0 comments

Comments

@MDaskalovAtBE
Copy link

How to make my own xml file that when picked it will resolve the committed files auto and there will be no need of
<file>/path/to/file/</file>
foreach file that has been changed?

In my .xml I have

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
    <description>The coding standard for PHP_CodeSniffer itself.</description>

    <arg name="basepath" value="."/>
    <arg name="colors"/>

    <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
    <rule ref="Generic.Commenting.Todo"/>
    <rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
    <rule ref="Generic.ControlStructures.InlineControlStructure"/>
    <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
    <rule ref="Generic.Formatting.SpaceAfterCast"/>
    <rule ref="Generic.NamingConventions.ConstructorName"/>
    <rule ref="Generic.PHP.DeprecatedFunctions"/>
    <rule ref="Generic.PHP.LowerCaseKeyword"/>
    <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
    <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
    <rule ref="PSR2.Classes.PropertyDeclaration"/>
    <rule ref="PSR2.Methods.MethodDeclaration"/>
    <rule ref="PSR2.Files.EndFileNewline"/>
    <rule ref="PSR12.Files.OpenTag"/>
    <rule ref="Zend.Files.ClosingTag"/>


    <!-- We use custom indent rules for arrays -->
    <rule ref="Generic.Arrays.ArrayIndent"/>
    <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
        <severity>0</severity>
    </rule>
    <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
        <severity>0</severity>
    </rule>
    <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
        <severity>0</severity>
    </rule>
    <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
        <severity>0</severity>
    </rule>

    <!-- Have 12 chars padding maximum and always show as errors -->
    <rule ref="Generic.Formatting.MultipleStatementAlignment">
        <properties>
            <property name="maxPadding" value="12"/>
            <property name="error" value="true"/>
        </properties>
    </rule>


    <!-- Private methods MUST not be prefixed with an underscore -->
    <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
        <type>error</type>
    </rule>

    <!-- Private properties MUST not be prefixed with an underscore -->
    <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
        <type>error</type>
    </rule>

    <!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
    <rule ref="Generic.Strings.UnnecessaryStringConcat"/>

</ruleset>

When I committed this file

<?php

$something = array(
    'asd' => 'asd',
    'asdss'   => 'sss'
);

echo $something;



I was expecting it will fail, but it returned green, if I use the default PSR2 as arg in the .yml and remove the xml the file fails as it should.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant