def use_file_metadata(file_path: Path) -> FileMetadata: with new_temp_dir() as temp_dir: new_file_path = temp_dir / file_path.name text = file_path.read_text() new_file_path.write_text(text) file_target = explore_file(new_file_path) yield file_target
def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: with new_temp_dir() as temp_dir: output_path = temp_dir / 'output.xml' command = self._create_command(path, output_path) run_in_subprocess(command) issues = parse_xml_file_result(output_path, self.inspector_type, self.choose_issue_type, IssueDifficulty.get_by_issue_type, self.origin_class_to_pattern, {}) output_path.unlink() return issues
def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: if not (check_set_up_env_variable(DETEKT_DIRECTORY_ENV) and check_set_up_env_variable(DETEKT_VERSION_ENV)): return [] with new_temp_dir() as temp_dir: output_path = temp_dir / 'output.xml' command = self._create_command(path, output_path) run_in_subprocess(command) return parse_xml_file_result(output_path, self.inspector_type, self.choose_issue_type, IssueDifficulty.get_by_issue_type, self.origin_class_to_pattern, {})
def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: if not (check_set_up_env_variable(PMD_DIRECTORY_ENV) and check_set_up_env_variable(PMD_VERSION_ENV)): return [] with new_temp_dir() as temp_dir: output_path = Path(temp_dir / 'out.csv') language_version = config.get('language_version') if language_version is None: logger.info( f"The version of Java is not passed. The version to be used is: {DEFAULT_JAVA_VERSION.value}.", ) language_version = DEFAULT_JAVA_VERSION command = self._create_command(path, output_path, language_version, config['n_cpu']) run_in_subprocess(command) return self.parse_output(output_path)