def report_churn()
  require File.join(File.dirname(__FILE__), '..', 'churn', 'churn_calculator')
  Churn::ChurnCalculator.new({
                               :minimum_churn_count => ENV['CHURN_MINIMUM_CHURN_COUNT'],
                               :start_date => ENV['CHURN_START_DATE'],
                               :ignore_files => ENV['CHURN_IGNORE_FILES'],
                             }).report
end

desc "Report the current churn for the project"
task :churn do
  report = report_churn()
  puts report
end


def report_churn()
  require File.join(File.dirname(__FILE__), '..', 'churn', 'churn_calculator')
  params = {}
  { :minimum_churn_count => ENV['CHURN_MINIMUM_CHURN_COUNT'],
    :start_date          => ENV['CHURN_START_DATE'],
    :ignore_files        => ENV['CHURN_IGNORE_FILES'],
  }.each {|k,v| params[k] = v unless v.nil? }
  Churn::ChurnCalculator.new(params).report
end

desc "Report the current churn for the project"
task :churn do
  report = report_churn()
  puts report
end

Send params only for set environment variables.
Send params only for set environment variables.

Given ENV['CHURN_IGNORE_FILES'] is empty
Then :ignore_files will be provided with nil.
And options.fetch(:ignore_files) { "" } => nil

This breaks `@ignore_files = (options.fetch(:ignore_files){ "" }).split(',').map(&:strip)` in churn_calculator's initializer, with nil.split.
