def get_patch_file_path(self): """Get the absolute path to the patch file.""" patch_contents = self.patch_contents if patch_contents: return make_tempfile(patch_contents, ".diff") else: return None
def get_original_file_path(self): """Fetch the original file and return the filename of it. Returns: unicode: The filename of a new temporary file containing the original file contents. If the file is empty, return None. """ contents = self.original_file_contents if contents: return make_tempfile(contents, self.file_extension) else: return None
def get_patch_file_path(self): """Fetch the patch and return the filename of it. Returns: unicode: The filename of a new temporary file containing the patch contents. If the patch is empty, return None. """ patch_contents = self.patch_contents if patch_contents: return make_tempfile(patch_contents, '.diff') else: return None
def handle_files(self, files): # Get any extra file extensions we should process. self.file_exts = None if self.settings['extra_ext_checks']: self.file_exts = tuple( self.settings['extra_ext_checks'].split(',')) # If any configuration was specified, create a temporary config file. self.config_file = None if self.settings['config']: self.config_file = make_tempfile(content=self.settings['config']) super(JSHintTool, self).handle_files(files)
def run_pmd(self, source_file_path, rulesets): pmd_result_file_path = make_tempfile(extension='.xml') args = ( self.pmd_script_path, 'pmd', '-d', source_file_path, '-R', ','.join(rulesets), '-f', 'xml', '-r', pmd_result_file_path ) process = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) _, stderr = process.communicate() if stderr: raise PMDError("Error running PMD command line tool, " "command output:\n" + stderr) return pmd_result_file_path
def get_original_file_path(self): contents = self.original_file_contents if contents: return make_tempfile(contents) else: return None
def get_patched_file_path(self): contents = self.patched_file_contents if contents: return make_tempfile(contents) else: return None