Skip to content

"include-pattern" to file extensions #2486

Closed
@celorodovalho

Description

@celorodovalho

I'm trying to add an "include-pattern" in a specific rule, like that:

    <rule ref="Company.Files.PhtmlValidation">
        <exclude-pattern>*.php</exclude-pattern>
        <include-pattern>*.phtml</include-pattern>
    </rule>

And running over this command:

vendor/bin/phpcs --standard=/home/me/Workspace/project/vendor/company/module/phpcs/ruleset.xml /home/me/Workspace/project/app/code/Company/Module

And nothings happens.
But if I try with the command (with "--extensions=phtml"):

vendor/bin/phpcs --standard=/home/me/Workspace/project/vendor/company/module/phpcs/ruleset.xml /home/me/Workspace/project/app/code/Company/Module --extensions=phtml

it gives me the result:

FILE: ...orkspace/project/app/code/Company/Module/view/frontend/templates/js/teste-file.phtml
--------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------
 24 | ERROR | [x] Potentially XSS vulnerability. Please verify that output is escaped.
 25 | ERROR | [x] Potentially XSS vulnerability. Please verify that output is escaped.
 25 | ERROR | [x] @escapeNotVerified annotation detected. Please use the correct escape strategy and
    |       |     remove annotation. 1

The "include-pattern" should not include the phtml files like specified in ruleset.xml?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions