| View previous topic :: View next topic |
| Author |
Message |
parkerlewis
Joined: 06 Apr 2009 Posts: 3
|
Posted: Mon Apr 06, 2009 2:03 pm Post subject: [SOLVED] How can I integrate PHP_CodeSniffer into my NetBeans workflow? |
|
|
I've become accustomed to running PHP_CodeSniffer (phpcs for short) against my PHP projects in order to ensure that I've remembered to document and format my source correctly.
As a TextMate user I was able to use a bundle to hit a shortcut key combination and automatically run phpcs against the file that was currently opened in my editor, to see the results of its validation and identify anything that needed to be changed.
Is there any easy way for me to get similar behavior out of NetBeans, either by writing a plugin or using some built-in "run external command" feature that I might not be aware of? I'm envisioning some sort of integration where I'd get a window in the IDE that lists filenames and corresponding lines that contain errors, much in the same way that the "Tasks" window shows any TODO lines from my project's files.
Last edited by parkerlewis on Tue Apr 07, 2009 7:22 pm; edited 1 time in total |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
Posted: Tue Apr 07, 2009 11:16 am Post subject: How can I integrate PHP_CodeSniffer into my NetBeans workflow? |
|
|
Hi,
On pondělí 06 dubna 2009 16:03:25 parkerlewis wrote:
| Quote: | I've become accustomed to running PHP_CodeSniffer
(http://pear.php.net/package/PHP_CodeSniffer) (phpcs for short) against my
PHP projects in order to ensure that I've remembered to document and format
my source correctly.
As a TextMate user I was able to use a bundle to hit a shortcut key
combination and automatically run phpcs against the file that was currently
opened in my editor, to see the results of its validation and identify
anything that needed to be changed.
Is there any easy way for me to get similar behavior out of NetBeans,
either by writing a plugin or using some built-in "run external command"
feature that I might not be aware of? I'm envisioning some sort of
integration where I'd get a window in the IDE that lists filenames and
corresponding lines that contain errors, much in the same way that the
"Tasks" window shows any TODO lines from my project's files.
|
this is more work around or hack but it could help you I guess:
- create a PHP project
- create a new Run Configuration for it - "Script (Run in Command Line)" (right
click your project in Projects view and select Properties)
- uncheck "Use Default PHP Interpreter" and browse for your "PHP Interpreter"
(PHP_CodeSniffer in your case)
And you are done! Then just Run File (Shift + F6) and the output is displayed
in Output Window.
BTW you should see the name of your Run Configuration in the combo box in the
main menu toolbar so you can easily change it.
HTH,
Tomas
--
Tomas Mysik
address-removed |
|
| Back to top |
|
 |
parkerlewis
Joined: 06 Apr 2009 Posts: 3
|
Posted: Tue Apr 07, 2009 7:18 pm Post subject: Re: How can I integrate PHP_CodeSniffer into my NetBeans workflow? |
|
|
| Tomas Mysik wrote: |
this is more work around or hack but it could help you I guess:
- create a PHP project
- create a new Run Configuration for it - "Script (Run in Command Line)" (right
click your project in Projects view and select Properties)
- uncheck "Use Default PHP Interpreter" and browse for your "PHP Interpreter"
(PHP_CodeSniffer in your case) |
Hi Tomas,
Thanks for your tip, the idea of creating a new Run Configuration was just what I needed.
For my existing project, I just added a new Run Configuration via the dropdown in the toolbar, and set the path to the "PHP Interpreter" to point to my PHP_CodeSniffer phpcs executable instead.
Now, when I use the Run File or Shift-F6 command, the file is validated by PHP_CodeSniffer and the results are displayed in a NetBeans window, just like I wanted.
Thanks! |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
Posted: Wed Apr 08, 2009 12:42 pm Post subject: How can I integrate PHP_CodeSniffer into my NetBeans workflow? |
|
|
Hi,
On úterý 07 dubna 2009 21:18:49 parkerlewis wrote:
| Quote: | Thanks for your tip, the idea of creating a new Run Configuration is very
helpful. I guess my last problem now is that the Run Configuration always
tries to pass my index page as a parameter to the "PHP Interpreter" (which
is PHP_CodeSniffer in this case) but I would rather have it pass the file
that is currently opened in the editor as the parameter instead. Is there
any variable I can use to accomplish that behavior?
|
have you followed the steps and "Run File" action (Shift + F6) does not work
for you? If so, then please double check your Run Configuration (Script, PHP
Interpreter must be your PHP_CodeSniffer script or some shell/bat file that will
run it). Could you please attach screenshot of your Run Configuration window?
That would help, thanks.
(I guess you are likely running your project (F6) and not your file (Shift +
F6).)
HTH,
Tomas
--
Tomas Mysik
address-removed |
|
| Back to top |
|
 |
parkerlewis
Joined: 06 Apr 2009 Posts: 3
|
Posted: Wed Apr 08, 2009 12:49 pm Post subject: |
|
|
| Yes, the "Run File" command is what I was looking for, as opposed to "Run Project". I've edited my original reply to reflect that. Thanks again! |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
Posted: Thu Apr 09, 2009 9:43 am Post subject: [SOLVED] How can I integrate PHP_CodeSniffer into my NetBeans workflow? |
|
|
Hi,
On středa 08 dubna 2009 14:49:12 parkerlewis wrote:
| Quote: | Yes, the "Run File" command is what I was looking for, as opposed to "Run
Project". I've edited my original reply to reflect that. Thanks again!
|
I'm glad I could help you.
Tomas
--
Tomas Mysik
address-removed |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|