Skip to content

Instantly share code, notes, and snippets.

@amokan
Last active August 29, 2015 14:22
Show Gist options
  • Save amokan/a30afe721ea225a34437 to your computer and use it in GitHub Desktop.
Save amokan/a30afe721ea225a34437 to your computer and use it in GitHub Desktop.
Ruby script to fix ember-cli-blanket lcov.info for code-climate

Ruby script to fix ember-cli-blanket lcov.info for code-climate

Replace <app name here> with your ember-cli app name

I'm currently running this script as a post-build step during my CI process and it is working well.

My blanket-options file has the cliOptions set to the following:

cliOptions: {
    lcovOptions: {
      outputFile: 'lcov.info'
    },
    reporters: ['lcov']
  }

I did have to define a number of manual loaderExclusions in blanket-options.js so code-climate accepted the lcov file. This seems to be due to the way ember-cli works. Some examples are:

'<app name>/initializers/export-application-global',
'<app name>/services/csrf',
'<app name>/controllers/object',
'<app name>/controllers/array',
'<app name>/config/environment'
#!/usr/bin/ruby
output_file = File.open('code.climate', 'w')
File.open('lcov.info', 'r') do |f|
f.each_line do |line|
if line.start_with?('SF:')
output_file.puts "#{line.strip.gsub(/<app name here>\//im, "app/")}.js\n"
else
output_file.puts line
end
end
f.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment