Skip to content

Commit

Permalink
Configure Simplecov in .simplecov
Browse files Browse the repository at this point in the history
Externalizing the config into `.simplecov` is considered best practice:
simplecov-ruby/simplecov#235 (comment)
  • Loading branch information
joe4dev committed Mar 24, 2016
1 parent 4704375 commit 86c99c2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
35 changes: 35 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://github.com/colszowka/simplecov#using-simplecov-for-centralized-config
# Maybe put some conditional here not to execute the code below unless ENV['COVERAGE'] == 'true'
# Lookup defaults: https://github.com/colszowka/simplecov/blob/master/lib/simplecov/defaults.rb
SimpleCov.start do
load_profile 'test_frameworks'
coverage_dir 'coverage'
command_name 'MiniTest'
merge_timeout 3600 # 1 hour
track_files "{app,lib}/**/*.rb"

# Groups
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
# add_group 'Mailers', 'app/mailers'
add_group 'Helpers', 'app/helpers'
add_group 'Jobs', %w(app/jobs app/workers)
add_group 'Libraries', 'lib'

add_group 'Long files' do |src_file|
src_file.lines.count > 100
end
class MaxLinesFilter < SimpleCov::Filter
def matches?(source_file)
source_file.lines.count < filter_argument
end
end
add_group 'Short files', MaxLinesFilter.new(5)

# Exclude these paths from analysis
add_filter '/config/'
add_filter '/db/'
add_filter 'lib/plugins'
add_filter 'vendor'
add_filter 'bundle'
end
25 changes: 0 additions & 25 deletions lib/simplecov_rails_custom.rb

This file was deleted.

1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'simplecov'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down

0 comments on commit 86c99c2

Please sign in to comment.