Closed kokokurak closed 8 years ago
The problem is actually in phpcs. If we will implement workaround on the level of linter to prevent running phpcs
when phpcs -l
returns errors, then it will completely resolve this and any future releated issues. phpcs
hangs but php -l
is not and we could use that for workaround.
@sormy You are right. When I disable SublimeLinter-phpcs, the problem with foreach
doesn't occur.
Actually, I posted this bug on phpcs and they already fixed that, but I think they have more bugs like that =) Actually I found two in a couple days =) I don't know what will be more efficient - to report each bug into phpcs or just implement workaround to prevent phpcs to run on files with bad syntax.
Personally, I would rather not see phpcs errors in Sublime Text while the code is invalid.
Personally, I'm too.
@sormy Great work bringing this to a replicable state
the best fix for SublimeLinter-php is to do not try to lint via phpcs/phpmd or something else if file is not valid based on php -l
result
I don't think the "fix" is in SL-php but in SL-phpcs instead.
I would rather not see phpcs errors in Sublime Text while the code is invalid.
We'd want to at least show that phpcs is not running because of errors. An error placed on the first character of the file with text stating so.
We'd want to at least show that phpcs is not running because of errors. An error placed on the first character of the file with text stating so
That would be nice.
So actually, last question is: "Will somebody find a time to make phpcs linter be used only if php linter was succeeded?" =)
Or: "Will PHP-CodeSniffer be fixed so that it doesn't hang and roast one's CPU when passed invalid code?"
Aedx in that case we need all to monitor when phpcs will hang, make dumps and send them to phpcs developers. I think they have a lot of bugs like this because they are primarily focused on linting of valid php code.
@sormy Alternatively, we could just edit phpcs' tokeniser slightly, so that it would return an error if incorrect syntax is found. What I think may be happening, is that the tokeniser is checking through, finds the start of a token, but cannot find the end of the token by the end of the input stream. As is such, phpcs simply hangs, as the tokeniser does not have any defined behaviour when the end of a stream is reached before the end of a token is reached.
yes, may be "convert all warnings and notices into exceptions" on phpcs level will help
Any progress on this issue?
kokokurak, try last phpcs
last phpcs 3.0 still hangs
Any updates?
@kokokurak Are you sure this only occurs with SL-php as opposed to SL-phpcs? If it is actually SL-phpcs, it would probably be wise to post an issue to that project, referencing this issue.
From my side it's only phpcs problem and I'm not sure that they will be able to fix it. phpcs is very unstable for wrong php syntax.
This isn't actually a bug with this linter package. I am going to create a new issue in the SublimeLinter/SublimeLinter-phpcs repo for introducing some sort of catch for the known issue within the phpcs linter itself. The real solution it seems is for the phpcs project to resolve this issue.
I'm on OS X Yosemite. From time to time, for me like about every hour, SublimeLinter-php is starting PHP task with 100% CPU usage. It never stops, unless I stop the task manually. I didn't know what starts that task, but found out that the issue is gone when I disable SublimeLinter-php.