Skip to content

php7-xmlreader required for WordPress Coding Standards beta container image #94

@lucyllewy

Description

@lucyllewy

I've tried using the beta docker image of codeclimate-phpcodesniffer to get access to a more recent phpcs build than is in stable. (I need access to disabling specific sniffs on a single line as documented at https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file. The inline // phpcs:ignore form is only available in phpcs since version 3.2.0, where the stable docker image by codeclimate is still on 2.9.1.

When I run the beta docker image I am greeted with the following log showing that the container is missing the php7-xmlreader package from the Alpine repository.

Log of execution
$ docker run --interactive --tty --rm --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -e phpcodesniffer Starting analysis Running phpcodesniffer: Done! error: (CC::CLI::Analyze::EngineFailure) engine phpcodesniffer failed with status 1 and stderr Unable to find image 'codeclimate/codeclimate-phpcodesniffer:beta' locally beta: Pulling from codeclimate/codeclimate-phpcodesniffer 5758d4e389a3: Already exists 4ae1f45a9f69: Pulling fs layer 0676d8c6ca5f: Pulling fs layer 5dd9411e7f0f: Pulling fs layer c0105a21377e: Pulling fs layer 7072198dee72: Pulling fs layer 119f7d69fd65: Pulling fs layer f4466a97c155: Pulling fs layer b5fd0274c371: Pulling fs layer c0105a21377e: Waiting 7072198dee72: Waiting 119f7d69fd65: Waiting f4466a97c155: Waiting b5fd0274c371: Waiting 0676d8c6ca5f: Download complete 4ae1f45a9f69: Verifying Checksum 4ae1f45a9f69: Download complete 4ae1f45a9f69: Pull complete 0676d8c6ca5f: Pull complete 5dd9411e7f0f: Verifying Checksum 5dd9411e7f0f: Download complete 5dd9411e7f0f: Pull complete 7072198dee72: Download complete c0105a21377e: Download complete c0105a21377e: Pull complete 7072198dee72: Pull complete f4466a97c155: Verifying Checksum f4466a97c155: Download complete b5fd0274c371: Verifying Checksum b5fd0274c371: Download complete 119f7d69fd65: Verifying Checksum 119f7d69fd65: Download complete 119f7d69fd65: Pull complete f4466a97c155: Pull complete b5fd0274c371: Pull complete Digest: sha256:670d7b4e245222e6735ccc29b7548baffd053dd9f267fbb0f0448af08d46feae Status: Downloaded newer image for codeclimate/codeclimate-phpcodesniffer:beta Exception: Class 'XMLReader' not found in /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php #0 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php(464): WordPressCS\WordPress\Sniffs\WP\I18nSniff->check_text() #1 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php(390): WordPressCS\WordPress\Sniffs\WP\I18nSniff->check_argument_tokens() #2 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionRestrictionsSniff.php(288): WordPressCS\WordPress\Sniffs\WP\I18nSniff->process_matched_token() #3 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionRestrictionsSniff.php(200): WordPressCS\WordPress\AbstractFunctionRestrictionsSniff->check_for_matches() #4 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php(213): WordPressCS\WordPress\AbstractFunctionRestrictionsSniff->process_token() #5 /usr/src/app/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php(910): WordPressCS\WordPress\Sniffs\WP\I18nSniff->process_token() #6 /usr/src/app/vendor/squizlabs/php_codesniffer/src/Files/File.php(498): WordPressCS\WordPress\Sniff->process() #7 /usr/src/app/vendor/squizlabs/php_codesniffer/src/Runner.php(631): PHP_CodeSniffer\Files\File->process() #8 /usr/src/app/Executor.php(124): PHP_CodeSniffer\Runner->processFile() #9 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1934): Executor->run() #10 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1846): fork_daemon->invoke_callback() #11 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1747): fork_daemon->fork_work_unit() #12 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1499): fork_daemon->process_work_unit() #13 /usr/src/app/Executor.php(33): fork_daemon->process_work() #14 /usr/src/app/engine.php(26): Executor->queueDirectory() #15 {main} 
My `.codeclimate` file
plugins: editorconfig: enabled: true fixme: enabled: true git-legal: enabled: true phpcodesniffer: enabled: true channel: beta config: standard: phpcs.xml.dist scss-lint: enabled: true
My `.phpcs.dist.xml` file
<?xml version="1.0"?> <ruleset name="WordPress Coding Standards for Plugins">	<description>Generally-applicable sniffs for WordPress plugins</description> <!-- What to scan -->	<file>.</file> <!-- Exclude built assets -->	<exclude-pattern>/build/</exclude-pattern> <!-- Exclude node_modules --> <exclude-pattern>*/node_modules/*</exclude-pattern> <!-- Exclude tests -->	<exclude-pattern>/tests/</exclude-pattern> <!-- Exclude vendor directories --> <exclude-pattern>*/vendor/*</exclude-pattern>	<exclude-pattern>/wp-includes</exclude-pattern>	<exclude-pattern>scoper.inc.php</exclude-pattern> <!-- Colors! Nice! --> <arg name="colors"/> <!--- Only check PHP files --> <arg name="extensions" value="php"/> <!-- Commandline options for PHPCS --> <arg value="s"/> <arg value="n"/> <!-- Rules: Check PHP version compatibility --> <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> <!-- <config name="testVersion" value="7.0-"/> --> <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP --> <!-- <rule ref="PHPCompatibilityWP"/> -->	<rule ref="Squiz.PHP.Eval"/> <!-- Rules: WordPress Coding Standards --> <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->	<config name="minimum_supported_wp_version" value="5.0"/>	<rule ref="WordPress">	<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>	<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>	</rule>	<rule ref="WordPress-Docs" />	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">	<properties> <!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->	<property name="prefixes" type="array" value="a_z_listing,the_a_z_listing,have_a_z_,get_the_a_z,get_the_az,the_a_z,the_az"/>	</properties>	</rule>	<rule ref="WordPress.WP.I18n">	<properties> <!-- Value: replace the text domain used. -->	<property name="text_domain" type="array" value="a-z-listing"/>	</properties>	</rule>	<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">	<properties>	<property name="blank_line_check" value="true"/>	</properties>	</rule>	<rule ref="WordPress.NamingConventions.ValidHookName">	<properties>	<property name="additionalWordDelimiters" value="-"/>	</properties>	</rule> </ruleset>

Metadata

Metadata

Assignees

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