def __executeSVN(self, command, arg = "", split=False): command = "svnlook --%s %s %s %s %s" % (self.type, self.txnName, command, self.reposPath, arg) if command in self.cache: return self.cache[command] output = Process.execute(command) if split: output = [x.strip() for x in output.split("\n") if x.strip()] self.cache[command] = output return self.cache[command]
def run(transaction, config): check = config.getArray("Checkstyle.CheckFiles", [".*\.java"]) ignore = config.getArray("Checkstyle.IgnoreFiles", []) files = transaction.getFiles(check, ignore) java = config.getString("Checkstyle.Java") classpath = config.getString("Checkstyle.Classpath") config = config.getString("Checkstyle.ConfigFile") command = "%s -classpath %s com.puppycrawl.tools.checkstyle.Main -c %s " % (java, classpath, config) files = [transaction.getFile(oneFile[0]) for oneFile in files.iteritems() if oneFile[1] in ["A", "U", "UU"]] try: Process.execute(command + " ".join(files)) except Process.ProcessException, e: msg = "Coding style errors found:\n\n" msg += e.output + "\n" msg += "See Checkstyle documentation for a detailed description: http://checkstyle.sourceforge.net/" return (msg, 1)