Skip to content

Commit

Permalink
Fix PHPCS checks on unwritable filesystems.
Browse files Browse the repository at this point in the history
In #744 a call to setConfigData() was added which has the `$temporary` parameter set to the default, which is `true`.

This causes PHPCS to attempt to write to `wp-content/plugins/plugin-check-trunk/vendor/squizlabs/php_codesniffer/CodeSniffer.conf` which is unwritable on immutable filesystems, causing the entire plugin check to abort.
  • Loading branch information
dd32 authored Dec 2, 2024
1 parent bea9cb5 commit a2c3ac3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ final public function run( Check_Result $result ) {

// Override installed_paths to load custom sniffs.
if ( isset( $args['installed_paths'] ) && is_array( $args['installed_paths'] ) ) {
Config::setConfigData( 'installed_paths', implode( ',', $args['installed_paths'] ) );
Config::setConfigData( 'installed_paths', implode( ',', $args['installed_paths'] ), true );

Check warning on line 103 in includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Abstract_PHP_CodeSniffer_Check.php#L103

Added line #L103 was not covered by tests
}

// Create the default arguments for PHPCS.
Expand All @@ -121,7 +121,7 @@ final public function run( Check_Result $result ) {
}

// Reset installed_paths.
Config::setConfigData( 'installed_paths', $installed_paths );
Config::setConfigData( 'installed_paths', $installed_paths, true );

// Restore original arguments.
$_SERVER['argv'] = $orig_cmd_args;
Expand Down

0 comments on commit a2c3ac3

Please sign in to comment.