Closed ghost closed 9 years ago
Hi there, can you please turn on show_debug = true and provide me with all of your settings please and the full debug output when running the plugin..
Below is an output when I run 'sniff this file': (turn on show_debug = true, but same)
Exception in thread Thread-26:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "./threading.py", line 858, in run
File "phpcs in /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 474, in run
File "phpcs in /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 143, in get_errors
File "phpcs in /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 421, in execute
File "phpcs in /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 424, in parse_report
File "phpcs in /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 150, in shell_out
TypeError: sequence item 0: expected str instance, list found
Below is my phpcs.sublime-settings:
{
"show_debug": false,
"scheck_executable_path":
[
"/opt/pfff/scheck"
],
"phpcs_executable_path":
[
"/Users/lo/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs"
],
"phpmd_executable_path":
[
"/Users/lo/.composer/vendor/phpmd/phpmd/src/bin/phpmd"
],
"phpcbf_executable_path":
[
"/Users/lo/.composer/vendor/phpcbf"
],
"php_cs_fixer_executable_path":
[
"/Users/lo/.composer/vendor/php-cs-fixer"
],
"phpcs_php_path":
[
"/Users/lo/Sites/hello/"
],
}
Below is my .composer/composer.json:
{
"require": {
"squizlabs/php_codesniffer": "*",
"pdepend/pdepend": "2.2.1",
"fabpot/php-cs-fixer": "^1.10"
},
"require-dev": {
"phpmd/phpmd": "@stable"
}
}
Below is my .composer/vendor/:
autoload.php composer pdepend sebastian symfony
bin fabpot phpmd squizlabs
@demavend Can you provide the output from the debug before the stack trace please, so I can see what commands are being run etc?
startup, version: 3083 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/lo/Library/Application Support/Sublime Text 3/Packages
state path: /Users/lo/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/lo/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.269979
using gpu buffer for window
startup time: 0.360197
first paint time: 0.379039
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_file_settings
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.quick_panel
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.02-bz2
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin Phpcs.phpcs
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
plugins loaded
Package Control: Installing 1 upgrades
ignored packages updated to: ["SideBarEnhancements", "Vintage"]
reloading Packages/SideBarEnhancements/Side Bar.sublime-settings
unloading plugin SideBarEnhancements.SideBar
unloading plugin SideBarEnhancements.SideBarAPI
unloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
Package Control: Upgraded SideBarEnhancements to 2015.10.11.02.01.59
ignored packages updated to: ["Vintage"]
reloading Packages/SideBarEnhancements/Side Bar.sublime-settings
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Preferences.sublime-settings
@demavend HI there, this still isn't giving me the commands you are running. I am expecting to see some debug/output with [Phpcs] in it.
How to debug Phpcs and see output?
Hi @demavend
Sublime Text > Preferences > Package Settings > PHP Code Sniffer > Settings - User
And have at the very least:
{
"show_debug": true,
}
But I think you already have settings in there, so just simply add the show_debug bit.
Then open the console, which you have done already, run the plugin (in whatever way you do that) and then you will get debug that shows you the exact commands being shelled out to the console.
It's same again. thank you. I'll just give up maybe.
Without seeing what commands are being run, it's going to be hard to help fix it I am afraid. It simply could be a config issue.
Hi, I have the same problem.
You can see my debug [Phpcs] php -l -d display_errors=On /Users/julien/Sites/www/project/application/frontend/controllers/access.php [Phpcs] php -l -d display_errors=On /Users/julien/Sites/www/project/application/frontend/controllers/access.php [Phpcs] cwd: /Users/julien [Phpcs] No syntax errors detected in /Users/julien/Sites/www/project/application/frontend/controllers/access.php
[Phpcs] phpcs --report=checkstyle --standard=PSR2 -n /Users/julien/Sites/www/project/application/frontend/controllers/access.php [Phpcs] phpcs --report=checkstyle --standard=PSR2 -n /Users/julien/Sites/www/project/application/frontend/controllers/access.php [Phpcs] cwd: /Users/julien Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublimeplugin.py", line 556, in run return self.run(edit) File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 649, in run File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 467, in run File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 143, in get_errors File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 219, in execute File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 222, in parse_report File "phpcs in /Users/julien/Library/Application Support/Sublime Text 3/Installed Packages/Phpcs.sublime-package", line 173, in shell_out File "./subprocess.py", line 824, in init File "./subprocess.py", line 1448, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'phpcs'
When I execute the command (phpcs --report=checkstyle --standard=PSR2 -n /Users/julien/Sites/www/project/application/frontend/controllers/access.php) in a terminal, I have no problem and I get the error list.
My sublime config file
{
"auto_complete": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"draw_minimap_border": false,
"extensions_to_blacklist":
[
],
"extensions_to_execute":
[
"php",
"inc"
],
"find_selected_text": false,
"font_size": 16,
"gutter": true,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 1,
"match_brackets": true,
"match_brackets_angle": false,
"match_brackets_braces": true,
"match_brackets_content": true,
"match_brackets_square": true,
"php_cs_fixer_additional_args":
{
},
"php_cs_fixer_executable_path": "/usr/local/php5/bin/php-cs-fixer",
"php_cs_fixer_on_save": false,
"php_cs_fixer_show_quick_panel": true,
"phpcbf_additional_args":
{
"--standard": "PSR2",
"-n": ""
},
"phpcbf_executable_path": "/usr/local/php5/bin/phpcbf",
"phpcbf_on_save": false,
"phpcbf_show_quick_panel": true,
"phpcs_additional_args":
{
"--standard": "PSR2",
"-n": ""
},
"phpcs_command_on_save": false,
"phpcs_executable_path": "/usr/local/php5/bin/phpcs",
"phpcs_execute_on_save": false,
"phpcs_icon_scope_color": "comment",
"phpcs_linter_command_on_save": false,
"phpcs_linter_regex": "(?P
Is there a config error ?
Thanks.
@fonkyju
Aye, please see the troubleshooting guide - You basically need to set the path you your PHPCS application
I've already see the troubleshooting page.
As you can see in my config, I have set all the path
"php_cs_fixer_executable_path": "/usr/local/php5/bin/php-cs-fixer", "phpcbf_executable_path": "/usr/local/php5/bin/phpcbf", "phpcs_executable_path": "/usr/local/php5/bin/phpcs", "phpmd_executable_path": "/usr/local/php5/bin/phpmd",
Moreover all theses applications are in my PATH but it doesn't work with blank path like "phpcs_executable_path": "".
@fonkyju The config you mention is not reflected in your console output though I'm afraid. If
"phpcs_executable_path": "/usr/local/php5/bin/phpcs",
Was being used this line:
[Phpcs] phpcs --report=checkstyle --standard=PSR2 -n /Users/julien/Sites/www/project/application/frontend/controllers/access.php
Would actually be:
[Phpcs] /usr/local/php5/bin/phpcs --report=checkstyle --standard=PSR2 -n /Users/julien/Sites/www/project/application/frontend/controllers/access.php
Moreover all theses applications are in my PATH but it doesn't work with blank path like "phpcs_executable_path": "".
Sublime Text generally does not look at your PATH, which is why we have to define them in ST
And so you see what's going wrong ?
Thanks
Yes, your configuration is incorrect, but unsure why. Is the configuration in the right file and in the right format:
The result with running PHP Code Sniffer:
My settings:
Below is the php code when I test with PHP Code Sniffer:
I don't believe this result.