AtomLinter / linter-phpcs

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

new phpcs 3.0.0 doesnt work with current linter-phpcs #254

Closed pmgouveia closed 7 years ago

pmgouveia commented 7 years ago

Please use the version 2.9.0 or change the composer.json to a fixed version.

(took 2hour to find this :( )

Fernando-Marquardt commented 7 years ago

The linter will use the version you provide in 'Executable Path' at settings or the one installed in your vendor folder if the 'Search for executables' option is enabled.

image

Arcanemagus commented 7 years ago

Yea, it looks like PHPCS v3 changed the method to execute it again, requiring an update.

Arcanemagus commented 7 years ago

Hmm, although the help describes a completely different way of specifying the filename in PHPCS v3, the current method (PHPCS v2.6 and up) works just fine.

Can you describe what you mean by "doesn't work anymore" @pmgouveia?

pmgouveia commented 7 years ago

probably just changing the README.md from:

composer global require "squizlabs/php_codesniffer=*"

to

composer global require "squizlabs/php_codesniffer=2.9.0"

Thanks for the support, and for the php stuff you made, good stuff! :)

Arcanemagus commented 7 years ago

@pmgouveia linter-phpcs does work with php_codesniffer=3.0.0 though, so I see no reason to do that.

Are you by any chance using custom standards that haven't updated to v3 yet?

mruz commented 7 years ago

How about this:

index.js:58 [exec] Process exited with no-zero code, stdout:  PHP_CodeSniffer version 3.0.0 (stable) by Squiz (http://www.squiz.net)(anonymous function) @ index.js:58
emitTwo @ events.js:106emit @ events.js:191maybeClose @ internal/child_process.js:877ChildProcess._handle.onexit @ internal/child_process.js:226
linter-registry.js [sm]:137 [Linter] Error running PHPCS Error: Process exited with non-zero code: null(…)(anonymous function) @ linter-registry.js [sm]:137_tickCallback @ internal/process/next_tick.js:103

linter-registry.js [sm]:137 [Linter] Error running PHPCS Error: Process exited with non-zero code: null(…)(anonymous function) @ linter-registry.js [sm]:137_tickCallback @ internal/process/next_tick.js:103
Fernando-Marquardt commented 7 years ago

@mruz If you run phpcs via cli, does it work?

Arcanemagus commented 7 years ago

@mruz Interesting, your phpcs is saying it failed when we request it to print out the version 😮. What OS are you on as none of the CI environments are having that issue.

mruz commented 7 years ago

yes, if I run on cli it works linux, atom 1.17.0-beta4

Arcanemagus commented 7 years ago

@mruz can you run the following:

$ phpcs --version
$ echo $?
mruz commented 7 years ago

PHP_CodeSniffer version 3.0.0 (stable) by Squiz (http://www.squiz.net) 139

Arcanemagus commented 7 years ago

@mruz An exit code of 0 means the program ran correctly. Anything else means there was an issue, and the value is program dependent. I have no idea what 139 means for phpcs but it means that on your system it thinks it failed when you are just asking it to print the version!

I'll add ignoring that as a workaround, but you definitely should figure out why phpcs thinks it crashed on your system.

mruz commented 7 years ago

cool, I'll investigate it, thanks

Fernando-Marquardt commented 7 years ago

It's weird, I could only find 1 spot where phpcs exit with a code different from 0-5 and it shouldn't happen when asking the phpcs version.

As you can see here: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Config.php#L662

I think that maybe there is a problem with your PHP installation, maybe an extension or something else making your PHP runtime exit with code 139.

I found a few references about this exit code, most pointing to the same issue: https://groups.google.com/forum/#!msg/omnetpp/_zonGWenUqg/pdTs1MPxcDAJ

Arcanemagus commented 7 years ago

Marking this as closed since I can't find a case where the original report is true, unless @pmgouveia was using custom standards which hadn't been updated for v3 yet and they have stopped responding...