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

Support config files #37

Conversation

paolomainardi
Copy link
Contributor

phpcs supports the usage of config files as "standard", this MR is intended to fix that.

@zdenekdrahos
Copy link
Member

Phpcs standard, as well as report templates, paths are relative to .phpqa.yml.
Could you please give an example when current .phpqa.yml doesn't work?
Thanks

@zdenekdrahos
Copy link
Member

We are using custom standard and it works when phpcs.standard is relative to .phpqa.yml

.phpqa.yml

phpcs:
    standard: app/phpcs.xml

phpmd:
    standard: app/phpmd.xml

app/phpcs.xml

<?xml version="1.0"?>
<ruleset name="Atoto">
    <description>The coding standard for Atoto.cz PHP source code</description>

    <rule ref="PSR1" />
    <rule ref="PSR2" />

    <rule ref="vendor/escapestudios/symfony2-coding-standard/Symfony2/ruleset.xml">
        <exclude name="Symfony2.Commenting.ClassComment.Missing" />
    </rule>

    <!-- tests -->
    <rule ref="Symfony2.Commenting.FunctionComment.MissingParamTag">
        <exclude-pattern>*/tests/*</exclude-pattern>
    </rule>
    <rule ref="Symfony2.Functions.ScopeOrder.Invalid">
        <exclude-pattern>*/tests/*</exclude-pattern>
    </rule>
</ruleset>

@paolomainardi
Copy link
Contributor Author

If you mix --config and a custom file, it doesn't work

@zdenekdrahos
Copy link
Member

Could you be more specific?
I think it should work. What we have:

$args[] = '--config=' . realpath(__DIR__ . '/../');

Are you using directory in --config?
directory/.phpqa.yml wouldn't work because .phpqa.yml is appended to --config.

@zdenekdrahos
Copy link
Member

zdenekdrahos commented Dec 10, 2016

@paolomainardi: could you try dev-master version? phpqa is stopped when custom standard does not exist:

$ phpqa --config non-existent-dir
                                           
  [RuntimeException]                                                  
  Invalid .phpqa.yml - 'non-existent-dir/.phpqa.yml' does not exist.
$ phpqa --config phpqa-config-directory-with-invalid-phpcs-standard

  [RuntimeException]                                                                                
  Unknown file in phpcs.standard. '/var/project/app/phpcs.xml' does not exist.

@zdenekdrahos
Copy link
Member

phpqa v1.8 should stop when you are using invalid standard or configuration file.
Feel free to reopen this PR or create new issue if you still have problems with configuration files.

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

Successfully merging this pull request may close these issues.

None yet

2 participants