Closed victor-v-rad closed 1 year ago
@victor-v-rad The problem is that you are telling PHPCS to parse XML files as if they were PHP by having this <arg name="extensions" value="xml"/>
in your ruleset.
PHPCS is not suitable for analysing XML files and would never attempt to parse them if it wasn't for that extensions
setting in your ruleset, so the real question is: what are you trying to do with that ? Why is that setting there ?
I'm not sure why there is an open PHP tag in your XML file, but it's causing PHPCS to attempt to parse the XML as PHP.
I'd suggest closing the PHP tag so the file is valid again, or just not telling PHPCS to process XML files as PHP files, as @jrfnl has mentioned already.
Thank you @gsherwood and @jrfnl for your advice and sorry for the late reply. As a workaround, I created a dummy tokenizer for XML to be able to sniff and validate XML content.
Describe the bug Open PHP tag in XML, impacts performance of PHP Tokenizer
Custom ruleset
To reproduce Steps to reproduce the behavior:
phpcs --standard=path/to/custom_ruleset.xml path/to/magento2-image-slider
Actual Results phpcs never finishes
Expected behavior phpcs finishes almost instantly
Versions (please complete the following information):
Additional context The issue is in this file https://github.com/venustheme/magento2-image-slider/blob/9bba8c275c81997e066cd8e3c87d2498f477692e/etc/widget.xml#L3
Opened PHP tag in xml file makes PHP Tokenizer parse XML as is it is PHP code