PHP, Coding Standards, and You, Continued

tags: ,

Last time, we learned how to use PHPCodeSnif­fer and a lit­tle com­mand line work to cre­ate read­able cod­ing stan­dards val­i­da­tion results (that is a mouth­ful). In this entry, I will doc­u­ment how to inte­grate PHPCodeSnif­fer val­i­da­tion into my edi­tor, SciTE.

Pre­req­ui­sites

Instruc­tions

  1. Down­load the php source file to your com­puter, and save it as phpcs-scite.php

  2. Open your SciTE User Options file. This is located in the Options menu, labeled as “Open User Options File”. Paste the fol­low­ing code in there.

command.name.1.*.php=PHP_CodeSniffer
command.1.*.php=php c:/scripts/phpcs-scite.php $(FilePath)
view raw gistfile1.txt This Gist brought to you by GitHub.
  1. Edit that last line you just pasted to point to the cor­rect loca­tion for phpcs-scite.php. Also, you may need to change the “1” in the last two lines to another num­ber if you already have cus­tom com­mands in the menu.

Now when­ever you have a PHP file open in SciTE, you will see an option to run PHP_​CodeSniffer in the Tools menu.

Feedback