Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows users #3

Open
almeidaz opened this issue Apr 21, 2015 · 9 comments
Open

Windows users #3

almeidaz opened this issue Apr 21, 2015 · 9 comments

Comments

@almeidaz
Copy link

Hi, This is a looking good one plugin ! I'm a windows user and i wanted to know if it's compatible with windows users.
i ve download from the repositery and i ve rename the folder from "sublime-PHP_CodeSniffer-master" to "PHP_CodeSniffer" then put him in \Roaming\Sublim text 3\Packages
i have edited my settings files with this value :

edit after post : "we didn't see double\ in path on the post of this message but they really exist !

// Path to PHP.
"php_path": "C:\Program Files (x86)\EasyPHP\binaries\php\php_runningversion\php.exe",

// Path to the PHPCS script.
"phpcs_path": "C:\php\pear\phpcs.bat",

// Path to the PHPCBF script.
"phpcbf_path": "C:\php\pear\phpcbf.bat",

I've got this error in sublim text console :

@echo off
REM PHP_CodeSniffer tokenizes PHP code and detects violations of a
REM defined set of coding standards.
REM
REM PHP version 5
REM
REM @category PHP
REM @Package PHP_CodeSniffer
REM @author Greg Sherwood gsherwood@squiz.net
REM @author Marc McIntyre mmcintyre@squiz.net
REM @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
REM @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
REM @link http://pear.php.net/package/PHP_CodeSniffer

if "%PHPBIN%" == "" set PHPBIN=C:\Program Files (x86)\EasyPHP\binaries\php\php_runningversion\php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "C:\php\pear\phpcs" %*

Then i have create windows environment variable
PHPBIN with value `C:\Program Files (x86)\EasyPHP\binaries\php\php_runningversion\php.exe
And change :

// Path to PHP.
"php_path": "%PHPBIN%",

the error message in sublime text disappeared
but ! no error is detect in my php file :( seem to be not working.
Do you have a working PHP_CodeSniffer.sublime-settings --User Example ? Thx for help.

Sorry for posting here. I know it's not the best place but it's difficult to contact you. I will delete this post if you ask me. And sry for my english :)
Cheers. Thx in advance.

@sertand
Copy link
Member

sertand commented Apr 21, 2015

Sorry, I have never tried using the plugin on Windows so it will be very hard for me to help you. My first suggestion would be to try running PHPCS on its own to see if it is actually working without using the plugin.

@almeidaz
Copy link
Author

Yes phpcs works in command line. But phpcbf doesnt recognize diff. I need to add --no-patch. There is fc command on windows similar as diff. This is the problem i think.

@almeidaz
Copy link
Author

I'm installing Cygwin to get those command. ! I will see.

@almeidaz
Copy link
Author

Nothing change, plugin doesn't work for me.

@sertand
Copy link
Member

sertand commented Apr 22, 2015

I have just got my hands on Windows and installed the plugin. It worked with these settings:

{
    "phpcs_path": "C:\\PHP_CodeSniffer\\scripts\\phpcs",
    "phpcbf_path": "C:\\PHP_CodeSniffer\\scripts\\phpcbf"
}

I did not need to specify the php_path.
Also I was using checked out copy of PHP_CodeSniffer instead of the one in Pear.

@almeidaz
Copy link
Author

Thx for reply.
by checked out copy you mean this one https://github.com/squizlabs/PHP_CodeSniffer ?
do you have cygwin installed too?
Because i didnt install all package from cygwin. that very huge.
i have installed "diff" and "patch" command. So if you think about command i need to install, tell me.
thx you for giving me hope :)

@sertand
Copy link
Member

sertand commented Apr 23, 2015

Yes, just clone PHP_CodeSniffer. I did not install cygwin or anything else. This plugin does not require you to install diff or patch, this is handled by the plugin.

@almeidaz
Copy link
Author

It's working ! Thx for your help.

i added

 "additional_args": [
 "--report-diff=%HOMEPATH%\\myreport.rpt",
],

this makes a file with diff for me. Do you know how can i replace %HOMEPATH% by the current directory of the sniffed file and replace myreport by the sniffed filename?

@leotm
Copy link

leotm commented Dec 10, 2016

You guys manage php-cs-fixer.bat the manual way too?
Since there's not pear install :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants