-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class 'PHP_CodeSniffer\Tests\FileList' not found #3021
Comments
@gz-ang I'm guessing you are using a test version of Composer
Having said that, looking over your script, I have a lot of questions: you seem to be running largely the script of the WordPressCS standard, but you also seem to be cloning WPCS.... and using Unless you are contributing to WPCS, this is not the script you should be using and if you are contributing to WPCS, you should be using the proper script. |
Just tested with WPCS Having taken a quick look at the repo: I don't even know where to start... but let me just say this:
Suggestion: close. |
Thank you for the advise, I think I might have confused myself by cloning the WPCS and using composer at the same time. I just realized what I did was really dumb and redundant. Thanks for the heads up. Now that you mentioned, I should remove that as well. Alright, I think I'll have to be clear to use only one method instead of mixing it up. Again, thanks a lot. :) |
I'm testing my code using phpcs and wpcs on Travis CI and I received this error when the build failed.
Fatal error: Uncaught Error: Class 'PHP_CodeSniffer\Tests\FileList' not found in /home/travis/build/nepmisdev/partners_arissto/vendor/squizlabs/php_codesniffer/tests/Core/AllTests.php:42
Stack trace:
#0 /home/travis/build/nepmisdev/partners_arissto/vendor/squizlabs/php_codesniffer/tests/AllTests.php(59): PHP_CodeSniffer\Tests\Core\AllTests::suite()
#1 [internal function]: PHP_CodeSniffer\Tests\PHP_CodeSniffer_AllTests::suite('PHP_CodeSniffer...')
#2 /home/travis/build/nepmisdev/partners_arissto/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(125): ReflectionMethod->invoke(NULL, 'PHP_CodeSniffer...')
#3 /home/travis/build/nepmisdev/partners_arissto/vendor/phpunit/phpunit/src/TextUI/Command.php(183): PHPUnit\Runner\BaseTestRunner->getTest('./vendor/squizl...', '/home/travis/bu...', Array)
#4 /home/travis/build/nepmisdev/partners_arissto/vendor/phpunit/phpunit/src/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#5 /home/travis/build/nepmisdev/partners_arissto/vendor/phpunit/phpunit/phpunit(61): PHPUnit in /home/travis/build/nepmisdev/partners_arissto/vendor/squizlabs/php_codesniffer/tests/Core/AllTests.php on line 42
What I understand from the error is that the class 'PHP_CodeSniffer\Tests\FileList' can't be loaded due to the 'T' in the 'Test' directory being capitalized while the directory should be 'test', am I interpreting this correctly?
This is the .travis.yml for my project
dist: trusty
cache:
apt: true
directories:
# Cache directory for older Composer versions.
- $HOME/.composer/cache/files
# Cache directory for more recent Composer versions.
- $HOME/.cache/composer/files
language: php
php:
- 7.1
- 7.2
- 7.3
- 7.4
- "nightly"
env:
# PHPCS
master
.- PHPCS_BRANCH="dev-master" LINT=1
# Lowest supported release in the 3.x series with which WPCS is compatible.
- PHPCS_BRANCH="3.5.0"
# Define the stages used.
# For non-PRs, only the sniff, ruleset and quicktest stages are run.
# For pull requests and merges, the full script is run (skipping quicktest).
# Note: for pull requests, "develop" should be the base branch name.
# See: https://docs.travis-ci.com/user/conditions-v1
stages:
- name: sniff
- name: quicktest
if: branch NOT IN (master, develop)
- name: test
if: branch IN (master, develop)
jobs:
fast_finish: true
include:
#### SNIFF STAGE ####
- stage: sniff
php: 7.4
env: PHPCS_BRANCH="dev-master"
addons:
apt:
packages:
- libxml2-utils
before_script:
- export PHPCS_DIR=/tmp/phpcs
- export SNIFFS_DIR=/tmp/sniffs
- git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR
- git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR
script:
# WordPress Coding Standards.
# @link https://github.com/WordPress/WordPress-Coding-Standards
# @link http://pear.php.net/package/PHP_CodeSniffer/
# - $PHPCS_DIR/bin/phpcs --runtime-set ignore_warnings_on_exit 1
allow_failures:
# Allow failures for unstable builds.
- php: "nightly"
- env: PHPCS_BRANCH="4.0.x-dev as 3.9.99"
before_install:
# Speed up build time by disabling Xdebug.
# https://johnblackbourn.com/reducing-travis-ci-build-times-for-wordpress-projects/
# https://twitter.com/kelunik/status/954242454676475904
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
install:
script:
# Lint the PHP files against parse errors.
- if [[ "$LINT" == "1" ]]; then composer lint; fi_
# Run the unit tests.
- composer run-tests
So, is there any workaround for this or am I doing something wrong cause this shouldn't be an issue?
P.S.: this is my first issue, please let me know if i did something bad on opening issues
The text was updated successfully, but these errors were encountered: