AtomLinter / linter-phpcs

Linter plugin for PHP, using PHP_CodeSniffer.
63 stars 31 forks source link

Error running PHPCS TypeError: Invalid Version: undefined #462

Open andy-preston opened 3 years ago

andy-preston commented 3 years ago

I'm getting the following message in my Atom console ever time I try to run linter-phpcs

I assume it's got something to do with Atom's continuous changing of the linter API???

/home/andyp/.atom/packages/linter/dist/index.js:1 [Linter] Error running PHPCS TypeError: Invalid Version: undefined at new SemVer (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:314) at compare (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:647) at Function.gte (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:703) at Object. (/home/andyp/.atom/packages/linter-phpcs/lib/main.js:224) at Generator.next () at step (/home/andyp/.atom/packages/linter-phpcs/lib/main.js:5) (anonymous) @ /home/andyp/.atom/packages/linter/dist/index.js:1 /home/andyp/.atom/packages/php-cs-fixer/lib/php-cs-fixer.coffee:240 php exited with code: 0

markb-wa commented 3 years ago

Can confirm that I am seeing the same behaviour.

Screenshot 2020-10-20 at 16 54 02

UziTech commented 3 years ago

Can you share your linter-phpcs settings and the output of phpcs --version in a terminal?

markb-wa commented 3 years ago

Certainly.

Output of phpcs --version: Screenshot 2021-03-31 at 09 05 40

linter-phpcs setings: Screenshot 2021-03-31 at 09 08 57 Screenshot 2021-03-31 at 09 08 31 Screenshot 2021-03-31 at 09 08 43

And for reference: Screenshot 2021-03-31 at 09 16 52

UziTech commented 3 years ago

Can you update to the latest version and provide the error if it is still happening?

andy-preston commented 3 years ago

Screenshots are a really unhelpful way of sharing information.

UziTech commented 3 years ago

It looks like the error comes from not being able to parse the phpcs version from the executable listed in the Executable Path setting.

I just released a new version (v1.8.1) that might provide a better error with more information that might be helpful.

If this happens again please share the error thrown. It should be something like: Cannot parse PHPCS version for {Executable Path}: '{version output}'

markb-wa commented 3 years ago

Can you update to the latest version and provide the error if it is still happening?

Have updated to the latest, and so far so good. Will update if I see the error recur.