A Free Template From Joomlashack

A Free Template From Joomlashack

CodeSniffer in Sublime Text 2

PDF Print E-mail
Written by Kirby   
Friday, 30 December 2011 16:01
Not only am I a newbie to Sublime Text 2 but I'm about as competent in Python as well. That said, using the "infinite monkeys typing"-method of coding, I got this CodeSniffer plugin to work eventually:

import os
import sublime
import sublime_plugin

class PhpcsCommand(sublime_plugin.TextCommand):  
    def run(self, edit):  
    	self.view.window().run_command("save")
    	folder_name, file_name = os.path.split(self.view.file_name())
     	self.view.window().run_command("exec", {'cmd': ['/usr/local/bin/phpcs',  '--standard=zend', \
     	'--tab-width=4', file_name]})
     	sublime.status_message("CodeSniffer executed on " + file_name)
     	

Some help derived from the new API documentation

Of course, you should improve/mutilate/bow down in thanks/cast aspersions at this code as you see fit.
 
Joomla 1.5 Templates by Joomlashack