Closed christoferd closed 11 years ago
Can you please paste in your configuration file as it looks to be config related.
@MindflowAU Any chance you could paste in t he configuration please as I cannot diagnose without it
Not sure which config file you want, do you mean the ST2 config default and user files? or PHPCS config? Crash Note: Re enabled the plugin. Opened one file, clicked inside the file and got all the errors below, then as I opened config files, ST2 crashed :(
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File ".\sublime_plugin.py", line 200, in on_selection_modified
callback.__module__, "on_selection_modified", FAST_EVENT_TIMEOUT)
File ".\sublime_plugin.py", line 154, in run_timed_function
ret = f()
File ".\sublime_plugin.py", line 199, in <lambda>
run_timed_function(lambda: callback.on_selection_modified(v),
File ".\phpcs.py", line 671, in on_selection_modified
File ".\phpcs.py", line 528, in should_execute
TypeError: argument of type 'NoneType' is not iterable
There is something broken with the plugin configuration file. I can only replicate this when I remove
"extensions_to_execute": [],
From the configuration file. The standard installation of this plugin has that line defined, so either the settings have been deleted or not being pulled down by whichever installation method you are using.
Unsure what OS you are using but if you go to Sublime Text Preferences, and from there:
Package Settings > PHP Code Sniffer > Settings - Default
This file that is opened should look like https://github.com/benmatselby/sublime-phpcs/blob/master/phpcs.sublime-settings If they don't, please copy and paste over.
Then from there, you then need to configure the plugin for your needs as per http://www.soulbroken.co.uk/code/sublimephpcs/#configuration
Hey Ben, thanks for the update :+1:
I may have changed that line, not sure, however there is [php] there, it is not empty. My user settings file is blank.
Default Config
{
// Plugin settings
// Turn the debug output on/off
"show_debug": false,
// Which file types (file extensions), do you want the plugin to
// execute for
"extensions_to_execute": ["php"],
// Do we need to blacklist any sub extensions from extensions_to_execute
// An example would be ["twig.php"]
"extensions_to_blacklist": [],
// Execute the sniffer on file save
"phpcs_execute_on_save": true,
// Show the error list after save.
"phpcs_show_errors_on_save": true,
// Show the errors in the gutter
"phpcs_show_gutter_marks": true,
// Show outline for errors
"phpcs_outline_for_errors": true,
// Show the errors in the status bar
"phpcs_show_errors_in_status": true,
// Show the errors in the quick panel so you can then goto line
"phpcs_show_quick_panel": true,
// The path to the php executable.
// Needed for windows, or anyone who doesn't/can't make phars
// executable. Avoid setting this if at all possible
"phpcs_php_prefix_path": "",
// Options include:
// - Sniffer
// - Fixer
// - Mess Detector
//
// This will prepend the application with the path to php
// Needed for windows, or anyone who doesn't/can't make phars
// executable. Avoid setting this if at all possible
"phpcs_commands_to_php_prefix": [],
// PHP_CodeSniffer settings
// Do you want to run the phpcs checker?
"phpcs_sniffer_run": true,
// Execute the sniffer on file save
"phpcs_command_on_save": true,
// It seems python/sublime cannot always find the phpcs application
// If empty, then use PATH version of phpcs, else use the set value
"phpcs_executable_path": "",
// Additional arguments you can specify into the application
//
// Example:
// {
// "--standard": "PEAR",
// "-n"
// }
"phpcs_additional_args": {
"--standard": "PEAR",
"-n": ""
},
// PHP-CS-Fixer settings
// Fix the issues on save
"php_cs_fixer_on_save": false,
// Show the quick panel
"php_cs_fixer_show_quick_panel": false,
// Path to where you have the php-cs-fixer installed
"php_cs_fixer_executable_path": "",
// Additional arguments you can specify into the application
//
// Example:
// {
// "--level": "all"
// }
"php_cs_fixer_additional_args": {
"--level": "all"
},
// PHP Linter settings
// Are we going to run php -l over the file?
"phpcs_linter_run": true,
// Execute the linter on file save
"phpcs_linter_command_on_save": true,
// It seems python/sublime cannot always find the php application
// If empty, then use PATH version of php, else use the set value
"phpcs_php_path": "",
// What is the regex for the linter? Has to provide a named match for 'message' and 'line'
"phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)",
// PHP Mess Detector settings
// Execute phpmd
"phpmd_run": false,
// Execute the phpmd on file save
"phpmd_command_on_save": true,
// It seems python/sublime cannot always find the phpmd application
// If empty, then use PATH version of phpmd, else use the set value
"phpmd_executable_path": "",
// Additional arguments you can specify into the application
//
// Example:
// {
// "codesize,unusedcode"
// }
"phpmd_additional_args": {
"codesize,unusedcode,naming": ""
},
// PHP Scheck settings
// Execute scheck
"scheck_run": false,
// Execute the scheck on file save
"scheck_command_on_save": false,
// It seems python/sublime cannot always find the scheck application
// If empty, then use PATH version of scheck, else use the set value
"scheck_executable_path": "",
// Additional arguments you can specify into the application
//
//Example:
//{
// "-php_stdlib" : "/path/to/pfff",
// "-strict" : ""
//}
"scheck_additional_args": {
"-strict" : ""
}
}
And you are still getting the error? Do you see the extra debug in there since my last commit?
Ben, OMG I just found something.
Alt+Clicking on Route::model('user', 'User');
class or method resulted in small error message in grey bar at bottom of ST2. (attached image)
HOwever - if I alt+click on the second line, it all works as expected! :-/
Here's the app and file https://github.com/MindflowAU/Laravel-4-Bootstrap-Starter-Site/blob/master/app/routes.php
So the original problem still exists, but now I can retitle it to "PHPcs not working in ".blade.php" template files (handlebars)", for example:
{{{ Lang::get('user/user.register') }}} ::
I'm afraid you have completely lost me now. Unsure what Alt+Clicking does, as that isn't related to the sublime-phpcs plugin? It looks like you are in Vintage mode? I've just put my ST2 into Vintage mode, and with the file above "routes.php" it generates 10 errors in PSR2, either by saving the file (if execute on save is on) or by just sniffing the file.
If I then take a "blade" file from Laravel and run it in this plugin I get:
"No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them." when using PSR2 in PHP_CodeSniffer, both from the plugin and the terminal script.
Sorry Ben, confusing with other plugin.
Yes I'm in Vintage mode, and code sniff did not work well inside handlebars.
Should I turn off vintage mode? Was trying to get used to some faster Vi stuff, but not a deal breaker.
Short Tags - um, blade files use handlebars no need for php tags. I guess that's an issue for sure then : )
Cheers, Chris
On 22 May 2013 18:51, Ben Selby notifications@github.com wrote:
I'm afraid you have completely lost me now. Unsure what Alt+Clicking does, as that isn't related to the sublime-phpcs plugin? It looks like you are in Vintage mode? I've just put my ST2 into Vintage mode, and with the file above "routes.php" it generates 10 errors in PSR2, either by saving the file (if execute on save is on) or by just sniffing the file.
If I then take a "blade" file from Laravel and run it in this plugin I get:
"No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them." when using PSR2 in PHP_CodeSniffer, both from the plugin and the terminal script.
— Reply to this email directly or view it on GitHubhttps://github.com/benmatselby/sublime-phpcs/issues/78#issuecomment-18265003 .
This plugin wraps PHP_CodeSniffer, so if PHP_CodeSniffer can't handle certain formats, this plugin will not be able to either. So I was just using the PSR2 standard for PHP_CodeSniffer as an example, not all standards will look for the tags.
As I mentioned, I can run the plugin with Vintage mode on, as the plugin can execute on save, via right click or the command palette, so this doesn't seem to be interfering with the plugin functionality.
All I can help with is regards to if you run the PHP_CodeSniffer command on a file in your terminal and you get different results than in the plugin. If you turn debug mode on for this plugin either in the default or user settings you will see the command that is being executed for phpcs
"show_debug": true,
Copy this command and run in terminal, ideally you get the same results.
Ok, all is good now, thank you! :)
Good news, no problem. Any issues, let me know.
Hi Ben, I've got similar error
Traceback (most recent call last):
File "./sublime_plugin.py", line 337, in run_
File "./phpcs.py", line 670, in run
File "./phpcs.py", line 501, in fix_standards_errors
File "./phpcs.py", line 139, in get_errors
File "./phpcs.py", line 246, in execute
TypeError: argument of type 'NoneType' is not iterable
When I right-click on any file or folder of my SF2 project and select PHP Code Sniffer Fix this file/directory (php cs fixer)
I'm using Sublime Text 2.0.2 And installed all requirements for sublime-phpcs but facebook/pfff
I've got the phar executable paths correctly specified at /~/.config/sublime-text-2/Packages/Phpcs/phpcs.sublime-settings
Moreover, phpcs show any option disabled when I right-click on a php file text inside my project.
What should I do?
Hi again Ben, I think I've solved previous reported errors.
But in other hand, I've got an OS permissions error when I try to fix with CS Fixer a php file, using this sublime plugin
[Phpcs] /var/www/myproject/php-cs-fixer.phar fix /var/www/myproject/src/Main/Components/Comment/Model/Interfaces/CommentCollectionInteface.php --verbose [Phpcs] /var/www/myproject/php-cs-fixer.phar fix /var/www/myproject/src/Main/Components/Comment/Model/Interfaces/CommentCollectionInteface.php --verbose [Phpcs] cwd: /home/myusername Traceback (most recent call last): File "./sublimeplugin.py", line 362, in run File "./phpcs.py", line 657, in run File "./phpcs.py", line 501, in fix_standards_errors File "./phpcs.py", line 139, in get_errors File "./phpcs.py", line 269, in execute File "./phpcs.py", line 272, in parse_report File "./phpcs.py", line 169, in shell_out File ".\subprocess.py", line 633, in init File ".\subprocess.py", line 1139, in _execute_child OSError: [Errno 13] S’ha denegat el permĂs //AUTHOR POST: This means Forbidden in catalan language
Any suggestion?
I seems that the error comes near this last line of code from ~/.config/sublime-text-2/Packages/Phpcs/phpcs.py corresponding the method _shellout(self, cmd): starting at line 161
"""
Fixes the fact that PHP_CodeSniffer now caches the reports to cwd()
- http://pear.php.net/package/PHP_CodeSniffer/download/1.5.0
- https://github.com/benmatselby/sublime-phpcs/issues/68
"""
home = expanduser("~")
debug_message("cwd: " + home)
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=info, cwd=home)
I've tested OS directory permissions by switching home variable to "/tmp" fixed value, but error remains even performing this cwd("/tmp") instead of cwd("/home/myusername")
@temple Have you seen this section in the readme?
Hi Ben,
Got an error with your Sublime Text 2 plugin. I just installed it and was testing to see what happens when I just type junk into php... didn't notice anything so I turned on debug and this is what I saw...
Traceback (most recent call last): File ".\sublime_plugin.py", line 272, in isenabled File ".\phpcs.py", line 605, in is_enabled File ".\phpcs.py", line 528, in should_execute TypeError: argument of type 'NoneType' is not iterable
Cheerio