10up / wpcs-action

GitHub Action to help you lint your PHP without additional dependencies within your codebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: You must supply at least one file or directory to process.

champsupertramp opened this issue · comments

Describe the bug

I'm getting the following error using the custom project rules:

ERROR: You must supply at least one file or directory to process.

Here's my phpcs.xml.dist:

<?xml version="1.0"?>
<ruleset name="Project Rules">

	<exclude-pattern>\.github/*</exclude-pattern>
	<exclude-pattern>vendor/*</exclude-pattern>
	<exclude-pattern>node_modules/*</exclude-pattern>
	<exclude-pattern>documentor/*</exclude-pattern>
	<exclude-pattern>\.idea/*</exclude-pattern>
	<exclude-pattern>includes/blocks/*</exclude-pattern>
	<exclude-pattern>dist/*</exclude-pattern>
	<exclude-pattern>build/*</exclude-pattern>
	<exclude-pattern>app/*</exclude-pattern>
	
	<rule ref="WordPress">
		<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
		<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
	</rule>

</ruleset>

.github/workflow/wpcs.xml:

name: WPCS check

on:
   pull_request:
   push:
      branches:
         - refactor
jobs:
   phpcs:
      name: WPCS
      runs-on: ubuntu-latest
      steps:
         - uses: actions/checkout@v2
         - name: WPCS check
           uses: 10up/wpcs-action@stable
           with:
               standard: 'WordPress|WordPress-Extra|10up-Default'
               use_local_config: 'true'
               repo_branch: 'refactor'

Here's the Debug Logs from Github Action Workflow:

Run 10up/wpcs-action@stable
  with:
    standard: WordPress|WordPress-Extra|10up-Default
    use_local_config: true
    repo_branch: refactor
    paths: .
    phpcs_bin_path: phpcs
/usr/bin/docker run --name a8b033785a691364582bc35a530130b5323_16a0e9 --label 936a8b --workdir /github/workspace --rm -e "INPUT_STANDARD" -e "INPUT_USE_LOCAL_CONFIG" -e "INPUT_REPO_BRANCH" -e "INPUT_ENABLE_WARNINGS" -e "INPUT_PATHS" -e "INPUT_EXCLUDES" -e "INPUT_STANDARD_REPO" -e "INPUT_PHPCS_BIN_PATH" -e "INPUT_EXTRA_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/Extended/Extended":"/github/workspace" 936a8b:033785a691364582bc35a530130b5323
Cloning into '/github/home/wpcs'...
Note: switching to '7da1894633f168fe244afc6de00d141f27517b62'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Using config file: /usr/bin/CodeSniffer.conf

Config value "installed_paths" added successfully
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
Check for warnings disabled
ERROR: You must supply at least one file or directory to process.

Run "phpcs --help" for usage information

Steps to Reproduce

Please use the following files content:

Here's my phpcs.xml.dist:

<?xml version="1.0"?>
<ruleset name="Project Rules">

	<exclude-pattern>\.github/*</exclude-pattern>
	<exclude-pattern>vendor/*</exclude-pattern>
	<exclude-pattern>node_modules/*</exclude-pattern>
	<exclude-pattern>documentor/*</exclude-pattern>
	<exclude-pattern>\.idea/*</exclude-pattern>
	<exclude-pattern>includes/blocks/*</exclude-pattern>
	<exclude-pattern>dist/*</exclude-pattern>
	<exclude-pattern>build/*</exclude-pattern>
	<exclude-pattern>app/*</exclude-pattern>
	
	<rule ref="WordPress">
		<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
		<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
	</rule>

</ruleset>

.github/workflow/wpcs.xml:

name: WPCS check

on:
   pull_request:
   push:
      branches:
         - refactor
jobs:
   phpcs:
      name: WPCS
      runs-on: ubuntu-latest
      steps:
         - uses: actions/checkout@v2
         - name: WPCS check
           uses: 10up/wpcs-action@stable
           with:
               standard: 'WordPress|WordPress-Extra|10up-Default'
               use_local_config: 'true'
               repo_branch: 'refactor'

Screenshots, screen recording, code snippet

No response

Environment information

Macbook Pro M2
MacOS Ventura 13.3.1

WordPress information

This is a private plugin that I'm trying to process.

Code of Conduct

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

For anyone running into a similar error: when using local config, the paths setting is ignored.
This also includes default paths: '.'!

You need to specify <file> to be checked inside the phpcs.xml, e.g.:

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress - doc comments" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">

	<description>WordPress project standards except for doc comment rules.</description>

	<file>wp-content/themes/path-to-your-theme</file>

	<rule ref="WordPress">
		<exclude name="Squiz.Commenting.FileComment.Missing"/>
		<exclude name="Squiz.Commenting.ClassComment.Missing"/>
		<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
		<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
		<exclude name="Squiz.Commenting.VariableComment.Missing"/>
	</rule>

</ruleset>