in Sublime Text 3
I have installed via the Package Manager
following packages:
- SublimeLinter
- SublimeLinter-phpmd
- SublimeLinter-phpcs
- and few others..
The problem is that neither phpmd
or phpcs
are working. When opening a php
file in ST3 and then clicking: ctrl
and ` I get following debug info:
SublimeLinter: debug mode: on
SublimeLinter: temp directory: c:\users\alekspav\appdata\local\temp\SublimeLinter3-alekspav
SublimeLinter: annotations activated: <builtin>
SublimeLinter: json activated: <builtin>
SublimeLinter: WARNING: phpcs deactivated, cannot locate 'phpcs'
SublimeLinter: annotations activated: <builtin>
SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'
SublimeLinter: php activated: C:\xampp\php\php.exe
SublimeLinter: WARNING: phpmd deactivated, cannot locate 'phpmd'
SublimeLinter: WARNING: htmltidy deactivated, cannot locate 'tidy'
SublimeLinter: WARNING: csslint deactivated, cannot locate 'csslint'
SublimeLinter: php: submitter.php ['C:\\xampp\\php\\php.exe', '-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off']
SublimeLinter: php output:
No syntax errors detected in -
I am particularry interested in these 2 lines:
- SublimeLinter: WARNING: phpcs deactivated, cannot locate 'phpcs'
- SublimeLinter: WARNING: phpmd deactivated, cannot locate 'phpmd'
What I tried to do to fix the problem is to edit users config file:
Sublime text 3: Preferences -> package settings -> sublime linter-> settings - user
And then added cmd
key as following:
"phpcs": {
"@disable": false,
"args": [],
"cmd": "C:/xampp/htdocs/web/vendor/bin/phpcs/",
"excludes": [],
"standard": "PSR2"
},
"phpmd": {
"@disable": false,
"args": [],
"cmd": "C:/xampp/htdocs/web/vendor/bin/phpmd/",
"excludes": [],
"rulesets": "cleancode,codesize,controversial,design,naming,unusedcode"
}
As you have guessed - this didn't resolve the issue. I also tried to write path without / at the end and also tried to use \ delimeter instead of /. And I also tried to specify PFAM file directly.. And also tried to use ${project} variable rather than whole C:/ path. I am still getting warnings after ST3 restart.
My other question would be - how to output "${project}" directory in debug window? Because I am not sure it is set correctly so I want to test it.
More info:
Sublime project directory is: C:\xampp\htdocs\web\test.sublime-project
Here are phpmd
and phpcs
installations:
- "C:\xampp\htdocs\web\vendor\bin\phpcs\phpcbf.phar"
- "C:\xampp\htdocs\web\vendor\bin\phpcs\phpcs.phar"
- "C:\xampp\htdocs\web\vendor\bin\phpmd\phpmd.phar"
Edit:
Seems like I was doing it wrong. I have added a composer.json
into project directory with following contents:
{
"require-dev": {
"squizlabs/php_codesniffer": "2.*",
"phpmd/phpmd" : "@stable",
"mongodb/mongodb" : "@dev"
}
}
After installing everything with composer install
command - I got vendor
folder created for me with lots of directories inside, including the bin
folder. It has all the necessary files now, but I am still getting the same error. Modules could not be found for some reason.