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

fix: InpsydeTemplates usage #85

Merged
merged 1 commit into from
Mar 7, 2024
Merged

fix: InpsydeTemplates usage #85

merged 1 commit into from
Mar 7, 2024

Conversation

shvlv
Copy link
Contributor

@shvlv shvlv commented Mar 7, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Documentation and logic fix.

What is the current behavior? (You can also link to an open issue here)
Documentation introduced in #81 PR leads to the broken behavior. Custom Inpsyde sniffs and sniffs imported in the Insyde ruleset are not applied to the templates directory if the package configuration file contains the following:

<rule ref="Inpsyde">
    <exclude-pattern>*/templates/*</exclude-pattern>
</rule>

What is the new behavior (if this is a feature change)?
I double-checked different options and asked for PHPCS maintainers' support (see PHPCSStandards/PHP_CodeSniffer#380), but apparently, PHPCS doesn't support what we need right now. I.e., exclude-pattern and include-pattern are applied globally (and exclude has priority).

It means disabling any of the Inpsyde rules from the InpsydeTemplates ruleset is impossible. So, we have to come back to the initial suggestion:

<rule ref="Inpsyde" />

<rule ref="InpsydeTemplates">
    <include-pattern>*/templates/*</include-pattern>
    <include-pattern>*/views/*</include-pattern>
</rule>

This way, the whole project will be checked with Inpsyde CS, and templates and views directories will also be checked with InpsydeTemplates CS. If someone needs to exclude NoElse or any rule, they should do it explicitly in the project configuration.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
It's rather a bug fix.

Other information:

@shvlv shvlv mentioned this pull request Mar 7, 2024
3 tasks
@shvlv shvlv merged commit da47537 into development Mar 7, 2024
26 checks passed
@shvlv shvlv deleted the fix/templates-ruleset branch March 7, 2024 08:48
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

Successfully merging this pull request may close these issues.

None yet

2 participants