def get_values(self): def process_output(myself, log: Logger, line: str, num: int): if '[deprecation]' in line: self.hit(re.sub(r'(.*java:)\[\d+,\d+\] \[deprecation\]( .*)', r'\1\2', re.sub(r'\s*\[WARNING\]\s+' , '', line.replace(os.getcwd() + '/', '').replace('[WARNING]', '')) )) if self.log.is_trace(): self.add_to_stats(line) return self.verbose or self.log.is_trace() return line.startswith("[INFO] Building Atlassian") or line.startswith('[ERROR]') or self.log.is_trace() maven = MavenCallable() maven.phase('clean').phase('test-compile').profile('jira-metrics').profile('ondemand') maven.property('jira.exclude.bundled.plugins') maven.option('--no-plugin-updates') if self.log.is_trace(): maven.option('-X') self.log.info('Compiling workspace to find deprecated methods usage...') maven.process_output = types.MethodType(process_output, maven) super().pre_files_scan('irrelevant') maven_return_code = self.run_maven(maven) super().post_files_scan('irrelevant') if maven_return_code != MavenCallable.success: raise MavenExecutionException self.log.trace( json.JSONEncoder(indent=True).encode(sorted(self.deprecated_stats.items(), key=operator.itemgetter(1)))) self.log.info('Compilation finished.') return super().get_values() if maven.returncode == 0 else {}
def get_values(self): def process_output(myself, log: Logger, line: str, num: int): if '[deprecation]' in line: self.hit( re.sub( r'(.*java:)\[\d+,\d+\] \[deprecation\]( .*)', r'\1\2', re.sub( r'\s*\[WARNING\]\s+', '', line.replace(os.getcwd() + '/', '').replace('[WARNING]', '')))) if self.log.is_trace(): self.add_to_stats(line) return self.verbose or self.log.is_trace() return line.startswith( "[INFO] Building Atlassian") or line.startswith( '[ERROR]') or self.log.is_trace() maven = MavenCallable() maven.phase('clean').phase('test-compile').profile( 'jira-metrics').profile('ondemand') maven.property('jira.exclude.bundled.plugins') maven.option('--no-plugin-updates') if self.log.is_trace(): maven.option('-X') self.log.info( 'Compiling workspace to find deprecated methods usage...') maven.process_output = types.MethodType(process_output, maven) super().pre_files_scan('irrelevant') maven_return_code = self.run_maven(maven) super().post_files_scan('irrelevant') if maven_return_code != MavenCallable.success: raise MavenExecutionException self.log.trace( json.JSONEncoder(indent=True).encode( sorted(self.deprecated_stats.items(), key=operator.itemgetter(1)))) self.log.info('Compilation finished.') return super().get_values() if maven.returncode == 0 else {}