#NEWLINE# @ task ( 'run_sonar_analysis' , description = 'Launches sonar-runner for analysis.' ) #NEWLINE# @ depends ( 'analyze' ) #NEWLINE# def run_sonar_analysis( project , logger ) : #NEWLINE# #INDENT# sonar_runner = build_sonar_runner ( project ) #NEWLINE# result = sonar_runner . run ( project . expand_path ( '$dir_reports/sonar-runner' ) ) #NEWLINE# if ( result . exit_code != 0 ) : #NEWLINE# #INDENT# logger . error ( 'sonar-runner exited with code {exit_code}. See {reports_dir} for more information.' . format ( exit_code = result . exit_code , reports_dir = project . expand_path ( '$dir_reports' ) ) ) #NEWLINE# if project . get_property ( 'verbose' ) : #NEWLINE# #INDENT# logger . error ( 'Contents of {0}:' . format ( result . error_report_file ) ) #NEWLINE# logger . error ( '\n' . join ( result . error_report_lines ) ) #NEWLINE# #UNINDENT# raise BuildFailedException ( 'Sonar analysis failed.' )