Saving <file.php>: Running 'phpcbf' Formatter (configure) - wordpress

I've recently set up WP coding standards in VSCode by following https://www.edmundcwm.com/setting-up-wordpress-coding-standards-in-vs-code/.
With this setup files aren't getting saved and shows this message at the bottom right:
Saving ‘plugin.php’: Running ‘phpcbf’ Formatter (configure).
The only way to save is to press Cancel when this appears.
Any idea?

Please use which phpcs & which phpcbf to find the paths.
which phpcs
e.g. "C:\Users{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcs
which phpcbf
e.g. C:\Users{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcbf
once you find the paths to the executables, open your vscode json settings and add double check that the executable settings for phpcs & phpcbf match the paths.
Examples:
"phpcs.executablePath": "C:\Users\{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcs.bat",
"phpcbf.executablePath": "C:\Users\{Your username}\AppData\Roaming\Composer\Vendor\bin\phpcbf.bat",

I think this issue is pretty widespread despite the lack of answers in this thread. Setting the paths as above does not fix things. For me, this happens when saving a file and there is nothing for the formatter to fix.
There is an open pull request for this issue that has been open for over a year now.
A fork of the project has popped up that specifically fixes this issue. Look for phpcbf in VSCode and find the one by Simone Baldini.
Try installing that to see if it resolves the problem.

Related

ATOM - CSSLINT ignore ids

Is there a way to make csslint in Atom ignore "ids", so I don't get the warning "Don't use IDs in selectors"?
Edit: My question was identified as a possible duplicate of "Disable warnings (ids selector) in linter-csslint on Atom?", but I mentioned in my own answer that I could not understand how to make the process to solve my problem. I ended up finding out.
Well, guys, I ended up discovering how to do that. The other questions similar to mine did solve the problem, but they were not so clear TO ME on how to make the solution work. If you guys go to github "https://github.com/ebednarz/csslintrc/blob/master/.csslintrc", there are some lines to ignore the elements. What wasn't that clear to me was "ok, what should I do with it?".
So you have two options (I use Windows). You either create a file in Atom or command line called ".csslintrc" and place it INSIDE THE FOLDER OF THE PROJECT you are working on OR you can place this file in your USER FOLDER IN WINDOWS. Like, "C:\Users\yourUserName". If you put it there, all the projects will use this file.

Prevent Atom Editor from auto creating files

at the moment I try to experiment a little bit with Atom for writing an API documentation with RAML. Everything works fine but one damn thing:
Everytime I type some file paths (e.g. !include schemas/file.schema Atom auto creates the file when I'm not quick enough with typing. So, in some cases I have a hole bunch of file-zombies in my schema folder. That's kind of annoying.
My setup is standard Atom on MacBook, with api-workbench plugin, which includes linter as well. I already had a look at all those settings concerning auto completion - nothing found there. Also, Google doesn't show any hints. Any Tips?
Best regards,
Chris
It looks like this is a defect in the api-workbench package:
Api workbench creates new schemas, while i type their paths. For example below, i can see two-three files created while i type full name:
E.g:
schemas:
- myschema: !include schemas/myschema.json
Will create following files:
schemas/my
schemas/mysche
schemas/myschema
schemas/myschemas.json - this file is existing, i've created it before. all other files are redudant and i have to delete them.
Bug is not reproduced with examples, which i can also include in my document. Having issues while edition RAML 0.8 files.
If you want to help the package maintainers fix the defect, can I suggest you put together a minimal but complete example that reproduces the issue, this will make it easier for them to identify and resolve the issue.

Wordpress template code messed up

Here is a screenshot of what's happening to my wordpresss template code time after time:
https://www.box.net/shared/zrql76wiimr790587yxj
I thought at first it was a notepad++ problem. But this occured also on phpstorm.
Any idea why that's happening?
Your code isn't messed up, this is a question about how your system handles lineendings.
Linux and OSX save lineendings differently from Windows.
Linux and OSX saves lineendings with a Line Feed (LF):
\n
While windows saves it with Carriage Return + Line Feed (CR+LF):
\r\n
So what is probably happening is that your file has been written on a system that doesn't save lineendings in the windows format. Your editor most probably supports these kind of line endings and can handle it, look into the menus of your editor.
** Below is part of an edit and not part of my answer.**
You can check EditorConfig which can be helpful when you are trying to keep settings across projects and/or editors and also, if you keep your code under git, Dealing with line endings article from Github may be also helpful.
End of edit
Read more here: Wiki article

Compilation errors setting up Box2D with Cocos2d in Xcode

I notice several other people have had similar problems, however this is a bit strange...
I have a new install of scode 4.2 and the most recent cocos2d from a few weeks back. I have changed all files that include Box2D to the C++ .mm file extension. I have also set a user header search path for appName/libs**.
When I compile either b2BroadPhase.cpp and/or b2CollideCircle.cpp are missing, or even more rare, Box2d.h is missing. I have checked and all of these files are in the correct location in my applications directory.
Can anyone tell me why the files are not being found and why the number of files missing is randomly fluctuating?
EDIT:
Ok, so I obviously don't understand Header Search Paths... Are they designed to point towards folders that wouldn't normally be searched? If I add a Header Search Path then I get 200+ errors saying box2D files cannot be found. If I don't add a header search path I get 1-3 errors saying files cannot be found.
Your issue is that you have set the "User Header Search Path". However, Box2D requires you to specify the path in the "Header Search Path" build setting. This is because Box2D is using C++ style angle bracket include statements:
#include <Box2D/Dynamics/b2Body.h>
If that should not solve the (or all of the) problem(s), check this:
If you assume the same Box2D path as it is in cocos2d-iphone:
cocos2d-iphone/external/Box2d/Box2D
Then your Box2D Header Search Path must point to
cocos2d-iphone/external/Box2d/Box2D
You may have specified the "Box2d" folder instead of the "Box2d/Box2D" folder. That is also a common mistake.
Your header search paths are most likely wrong. Would you mind posting what it is?
If your Box2D folder is in your Xcode folder (look in finder), it should be as simple as this:
$(SRCROOT)
or
$(SRCROOT)/Box2D
My problem was that I was having an #import "Box2D.h" statement on a file with a ".m" extension instead of ".mm" .. Changing the file extension (select file, press enter, add extra "m") got rid of all the box2d errors.
Hopefully this helps someone else!

Xcode4 code completions ignores code within static library

I created a static library and a project that uses it following the instructions found at http://www.sodeso.nl/?p=822. So far it works fine, with a “minor” exception: the code completion ignores all code in the library. So, if I start typing a method of a class inside the static library I get no code completion suggestions.
Is there any way to fix this?
I fixed this problem by specifying the full Header Search Path for my libraries in the main project settings. For example, replace:
Libraries/TestLib/
with
$(SOURCE_ROOT)/Libraries/TestLib/
I originally found the answer here.
Edit: It turns out the above solution only fixes part of the problem. As found in another question here, it turns out that there is also an issue with Xcode that is resolved in version 4.1. I'm using Xcode 4.2 beta and can confirm that the issue is fixed for me.
I've been wondering why I get code completion for certain things, and not others. It seems:
Static libraries: NO
Frameworks: YES
So if you package your static library as a framework, you should get code completion.
In my case I just readded all in "Header Search Path", so:
Remove all values in "Header Search Path"
Compile (probably it will fail)
Then add values again
In my case after this actions I enabled code completion again

Resources