Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import environment
  2. import subprocess
  3.  
  4. class Lint:
  5.     def __init__(self, source_file):
  6.         self.args = [ 'lint-nt.exe', '-w2', source_file ]
  7.         self.errors_found = 0
  8.  
  9.     def execute(self):
  10.         process = subprocess.Popen(self.args,
  11.                                    stdin=subprocess.PIPE,
  12.                                    stdout=subprocess.PIPE,
  13.                                    stderr=subprocess.STDOUT)
  14.         process.poll()
  15.         self.errors_found = process.returncode
  16.  
  17.     def containsErrors(self):
  18.         return self.errors_found
  19.  
  20. for file in environment.files():
  21.     if Lint(file).execute().containsErrors():
  22.         environment.failed('LINT')
  23.     else:
  24.         environment.passed('LINT')