Closed JAW-Dev closed 8 years ago
@jawittdesigns Have a look at the README.md, specifically https://github.com/benmatselby/sublime-phpcs#what-do-i-do-when-i-get-oserror-error-2-no-such-file-or-directory
@benmatselby Yes, I did. Did I specify the path. Yes I did. Do I still get the error? Yes.
Wow, thanks.
@jawittdesigns
It's still not working? Isn't clear that message, sorry
If still not working please paste in your config
I fixed that error by adding a $PATH in my .bash_profile to map it to MAMP, but it's still not using my custom ruleset file. The console shows it's not detecting any errors, but SublimeLinter is still showing the errors in the editor.
startup, version: 3114 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/jasonwitt/Library/Application Support/Sublime Text 3/Packages
state path: /Users/jasonwitt/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/jasonwitt/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 1.10149
using gpu buffer for window
using gpu buffer for window
startup time: 1.22941
first paint time: 1.2696
reloading plugin ABuntchOfPlugins
reloading plugin SublimeLinter.sublimelinter
reloading plugin SublimeLinter-contrib-stylelint.linter
SublimeLinter: stylelint linter loaded
reloading plugin SublimeLinter-phpcs.linter
SublimeLinter: phpcs linter loaded
plugins loaded
SublimeLinter: debug mode: on
SublimeLinter: temp directory: /var/folders/yq/r0qlnkg10rl13d9fffh_pkn00000gn/T/SublimeLinter3-jasonwitt
SublimeLinter: user shell: /bin/bash
SublimeLinter: computed PATH using /bin/bash:
/Applications/MAMP/bin/php/php7.0.0/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/X11/bin
/Applications/MAMP/Library/bin/
SublimeLinter: phpcs activated: /Applications/MAMP/bin/php/php7.0.0/bin/phpcs
SublimeLinter: phpcs: class-autoloader.php ['/Applications/MAMP/bin/php/php7.0.0/bin/phpcs', '--report=checkstyle', '--standard=WordPress']
SublimeLinter: phpcs output:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.6.1">
<file name="/private/var/folders/yq/r0qlnkg10rl13d9fffh_pkn00000gn/T/SublimeLinter3-jasonwitt/class-autoloader.php">
<error line="62" column="33" severity="error" message="trigger_error Debug code is not allowed on VIP Production" source="WordPress.VIP.RestrictedFunctions.error_log"/>
<error line="71" column="29" severity="error" message="trigger_error Debug code is not allowed on VIP Production" source="WordPress.VIP.RestrictedFunctions.error_log"/>
</file>
</checkstyle>
Package Control: Skipping automatic upgrade, last run at 2016-06-03 12:16:54, next run at 2016-06-03 13:16:54 or after
[Phpcs] Project files:
[Phpcs] Current: /Volumes/Untitled/Sublime Projects/bbpress-live-preview.sublime-project
[Phpcs] Last Known: None
[Phpcs] Project files have changed, commence the reload
[Phpcs] /Applications/MAMP/bin/php/php7.0.0/bin/php -l -d display_errors=On /Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/helpers/class-autoloader.php
[Phpcs] /Applications/MAMP/bin/php/php7.0.0/bin/php -l -d display_errors=On /Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/helpers/class-autoloader.php
[Phpcs] cwd: /Users/jasonwitt
[Phpcs] No syntax errors detected in /Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/helpers/class-autoloader.php
[Phpcs] /Applications/MAMP/bin/php/php7.0.0/bin/phpcs --report=checkstyle --standard=/Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/ruleset.xml /Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/helpers/class-autoloader.php
[Phpcs] /Applications/MAMP/bin/php/php7.0.0/bin/phpcs --report=checkstyle --standard=/Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/ruleset.xml /Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/helpers/class-autoloader.php
[Phpcs] cwd: /Users/jasonwitt
[Phpcs] <?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.6.1">
</checkstyle>
[Phpcs] Linter found 0 errors
[Phpcs] Sniffer found 0 errors
Which are you trying to fix? SublimeLinter of phpcs ? That's too different plugins
And using two different standards from what I can see
I'm trying to get phpcs to use the custom ruelset file.
I'm not sure how I have two different rulesets. I only have it defined in my project file, and I have the WordPress in the SublimeLinter settings or else it just defaults to the normal linter.
{
"folders":
[
{
"path": "/Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview"
}
],
"settings":
{
"phpcs":
{
"phpcs_additional_args":
{
"--standard": "/Volumes/Untitled/Work/dev/_plugins/bbpress-live-preview/ruleset.xml"
}
}
}
}
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"phpcs": {
"@disable": false,
"args": [],
"excludes": [],
"standard": "WordPress",
},
"stylelint": {
"@disable": true,
"args": [],
"excludes": []
}
},
"mark_style": "fill",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
@jawittdesigns
I've just tried this and it is working fine:
{
"folders":
[
{
"path": "/Users/Ben/git/apps/myapplication"
}
],
"settings": {
"phpcs": {
"phpcs_additional_args": {
"--standard": "/Users/Ben/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCS/ruleset.xml",
"-n": ""
}
}
}
}
And this is the output:
[Phpcs] /Users/Ben/.composer/vendor/bin//phpcs --report=checkstyle -n --standard=/Users/Ben/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCS/ruleset.xml /Users/Ben/git/apps/myapplication/file.php
[Phpcs] cwd: /Users/Ben
[Phpcs]
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.6.1">
<file name="/Users/Ben/git/apps/myapplication/file.php">
<error line="4" column="2" severity="error" message="Missing @category tag in file comment" source="PEAR.Commenting.FileComment.MissingCategoryTag"/>
<error line="4" column="2" severity="error" message="Missing @package tag in file comment" source="PEAR.Commenting.FileComment.MissingPackageTag"/>
... etc
So this is working as intended. Cannot comment on the SublimeLinter as that is a different plugin
Hi, I have made it working after few minutes of R&D phew Step1 is to download all the .phar files, and move them to your /usr/local/bin folder, and make sure, you give them 777 permission to these files.
After that open a new terminal session, and try to type phpcs.phar, and if it works, then do following as below : Below is the settings you have to use on sublime-text 4 user settings file of the phpcs package.
If it does not work, then add below settings
First download all the .phar from the websites, and then in the settings
{
"phpcs_php_path": "/usr/local/opt/php@7.4/bin/php",
"phpcs_executable_path": "/usr/local/bin/phpcs.phar",
"phpcbf_executable_path":"/usr/local/bin/phpcbf.phar",
"phpmd_executable_path":"/usr/local/bin/phpmd.phar",
}
I'm having trouble getting my custom ruleset to work. When I turn on debug I get the error FileNotFoundError: [Errno 2] No such file or directory: 'phpcs'