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

Adjust coding standards so that it would be possible to run phpcs with Lando + PhpStorm #86

Closed
hkirsman opened this issue Nov 3, 2022 · 2 comments

Comments

@hkirsman
Copy link
Collaborator

hkirsman commented Nov 3, 2022

It seems it's possible to make PhpStorm run coding standards real time from Lando: https://github.com/HBFCrew/lando-docs-examples/blob/master/Drupal-PHPStorm-Lando-Setting-Code-Sniffer-Debugging.md#drupal-coding-standards-coder-codesniffer

There's some configuring in PhpStorm.

And also some adjustments need to be made to Code Quality.

Here's an example rule that seems to work ( vendor/wunderio/code-quality/rulesets/WunderDrupal/ruleset.xml ).
If this works with GrumPHP then we can commit it.

<?xml version="1.0"?>
<!-- See http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php -->
<ruleset name="WunderDrupal">
    <description>Drupal coding standard</description>

    <!-- exclude some Drupal files that contain issues -->
    <exclude-pattern>*default.settings.php</exclude-pattern>

    <!-- exclude minified files -->
    <exclude-pattern>*.min.*</exclude-pattern>

    <!-- exclude third-party node modules -->
    <exclude-pattern>node_modules/</exclude-pattern>

    <!-- exclude CSS files, where we don't usually follow Drupal standards  -->
    <exclude-pattern>*.css</exclude-pattern>

    <rule ref="../../../../slevomat/coding-standard/SlevomatCodingStandard"></rule>

    <rule ref="../../../../drupal/coder/coder_sniffer/Drupal">
        <exclude name="Drupal.Files.TxtFileLineLength" />
        <exclude name="Drupal.InfoFiles.AutoAddedKeys" />
        <exclude name="Drupal.Commenting.InlineComment.DocBlock" />
    </rule>
</ruleset>

Also it seems it's not possible to add more than 1 rule at a time, then we'd need to create 1 rule that combines WunderDrupal + WunderSecurity.

Todo:

  • create the 1 config file
  • Create documentation to set this up. Also find out why it could stop working (as it has for me).
    image
    .module was missing from extensions
@hkirsman
Copy link
Collaborator Author

hkirsman commented Nov 3, 2022

We were able to make this work with Mario without making customizations to the above file. But because we can't seem to enable multiple rules, we'd need to have 1 that combines the 2. So at the moment we only would have WunderDrupal enabled.

image

@hkirsman
Copy link
Collaborator Author

hkirsman added a commit that referenced this issue Nov 11, 2022
…rds-so-that-it-would-be-possible-to-run-phpcs-with-Lando-PhpStorm

#86 Add 1 ruleset to group all Wunder rulesets.
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