-
Notifications
You must be signed in to change notification settings - Fork 6
ERROR: option "--no-patch" not known #11
Comments
I also noticed this watching phpcbf.js, I attempted to delete the argument.. still no luck, running phpcbf with --standard=WordPress path/to/file from the cmd works fine for me.. still couldn't find a solution to run that within atom editor.. Question to you that's unrelated: I am new to the atom editor therefore i would like to ask how did you get that output? where is the console panel that shows you that? |
Here is my solution. Removed the 1 argument. Replace this line
|
@Vertigoooo Just open View > Developer > Toggle Developer Tools, or press |
@burhandodhy Hi, thanks for posting your solution.. still no luck for me..
I get the following error message saying childProcess is undefined (?)
here are all the imports at the beginning of the file:
|
@burhandodhy I don't understand your "solution". For me, the solution is simply to remove the argument
|
@Arcesilas by removing the --no-patch. is it work for you ? Whenever I run phpcbf it gives the "No error fix" message, even file have tons of standard errors. |
I get the same message as you get. However, I think it is another bug, unrelated to this one. I've successfully tried with spawn instead of execFile to write on stdin on phpcbf:
I'm completely new to atom package development, so this piece of code may not be perfect, but it works for me. |
This is the equivalent to:
The final |
The problem does not seem to be from this package.
(where returns
Whereas running:
fixes the CS errors & warnings and displays the fixed source code on the output... The bug does not come from phpcbf itself, since running it on the original file fixes the errors and warning. The last dependency involved is temp-write node package, which may be buggy or may not correctly write the temporary file (could be an encoding issue?) |
Actually, it seems that phpcbf refuses to fix files which do not have |
Alternatively, you could use this:
temp-write allows us to specify a filepath. Unfortunately, when passing a filepath, temp-write will reate a temporary directory and create a name with that filepath. Some packages for temporary files manipulation allow to pass a suffix... It's not the case with temp-write and it's not my call to decide to use another dependency. So I've decided to hash the current filepath, to avoid "collisions", even if temporary files should not be manipulated manually. Feel free to no use crypto and not hash the filepath:
|
@Arcesilas Hey thanks for sharing with us.. I got a bit lost with your explanations.. Maybe you should open a fork for this project fixing the issues.. offering a solution that work's since beautifier doesn't seem to work with phpcbf for me.. |
https://gist.github.com/Arcesilas/28e08aa09031676ed417b42955600de0 There are 3 possible versions:
As I said, the problem is that phpcbf does not work on files without .php extension. Both of the "tempfile solutions" use .php suffixed files and the third one does not use files at all. I've already forked the repo, I may propose a pull request, but I'd like @jcartledge to give his opinion about the solutions proposed. |
@Arcesilas Hello again, thank you for sharing with me your solutions.. I have went over and copied the three of them into my phpcbf.js file and made sure to reload atom everytime and still no luck.. :) I started debugging the first two gists your published but then again code exists on the line with the 'which' expression.. tried the last version with the stdin then again you get phpcbf not defind.. changed it to a string (since it should be the name of the file to call), https://nodejs.org/api/child_process.html here you can see that it represents a string.. I used this.executablePath which is the absolute path to the phpcbf.phar file but if you have it in your path probably just phpcbf will be enough.. then i received an error from the stdin : eventually nothing worked.. i attempted to come up with a solution but i lack the knowledge of the atom api and overall developing packages for atom.. My idea is since the cli tool is working properly just with phpcbf --standard=WordPress path/to/file
and that did the job but i wouldn't like to go through all this process in the cmd just to reformat my code.. I am a C# developer and hence my habit is to reformat code with Ctrl+E, Ctrl+D from (visual studio) and so i created a shortcut for my convenience and i find it more practical then running the command in the prompt everytime: in keymaps file add:
|
Hi, Sorry for the delay, I'm not at my home now and finally have some time to answer. If you get an error saying that phpcbf is undefined, then it's not related to my solutions (which need phpcnf to be working). I don't know what the error can be, but I think it's not related to this package. |
@Arcesilas Hi, I eventually managed to used beautify to run phpcbf.. I recommend switching to atom-beautify |
Hi,
This package is not compatible with PHPCS 3.0 or greater and gives this error every time.
The text was updated successfully, but these errors were encountered: