Skip to content

Unclear error message: "PHP Code Sniffer is not available. Try running composer install first." #254

Closed

Description

@mrfoxtalbot

Describe the bug

I am seeing this error message on all the plugins I test:

PHP Code Sniffer is not available. Try running composer install first.

It appears to be something missing in the Plugin Check plugin itself, not so much the specific plugin I am checking.

Steps to Reproduce

  1. Install the Plugin Check plugin (Version 0.2.0)
  2. Test a plugin
  3. Notice the warning.

Screenshots, screen recording, code snippet

Screen Shot on 2023-09-21 at 12:00:57

Environment information

  • Plugin Check plugin (Version 0.2.0)
  • WP Version 6.3.1

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. bordoni commented on Sep 21, 2023

    @bordoni
    Member

    That is a super interesting report, I will check on a fresh new PHP locally to see if I can reproduce. On my current local and some of the InstaWP testing instances I used that wasn't a problem.

  2. self-assigned this
    on Sep 21, 2023
  3. bordoni commented on Sep 21, 2023

    @bordoni
    Member

    Figured out what happened. I will take a look into how to resolve that.

  4. shawn-digitalpoint commented on Sep 21, 2023

    @shawn-digitalpoint

    It's caused by plugin-check/inc/class-phpcs.php calling is_executable() as the first part of the run() method.

    That checks the permissions of the plugin-check/vendor/squizlabs/php_codesniffer/bin/phpcs file. That file is a PHP file so it doesn't actually need to have executable permissions when running from the web, but maybe there's other places that it runs via CLI so the check is needed? If that's the case, maybe only do the is_executable() check if PHP_SAPI === 'cli' ?

    The quick and dirty solution for making it work on the web is to change the permissions of the phpcs file to be executable, but making PHP files executable if there's not an actual reason to do so isn't good security practice.

  5. added this to the 0.2.1 milestone on Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Type] BugAn existing feature is broken

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions