metric_fu 4.3.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.metrics +55 -26
  3. data/.travis.yml +4 -1
  4. data/AUTHORS +12 -0
  5. data/Gemfile +1 -0
  6. data/HISTORY.md +24 -0
  7. data/README.md +27 -22
  8. data/checksum/metric_fu-4.3.1.gem.sha512 +1 -0
  9. data/checksum/metric_fu-4.4.0.gem.sha512 +1 -0
  10. data/lib/metric_fu.rb +28 -79
  11. data/lib/metric_fu/cli/helper.rb +1 -1
  12. data/lib/metric_fu/cli/parser.rb +1 -1
  13. data/lib/metric_fu/configuration.rb +104 -150
  14. data/lib/metric_fu/environment.rb +88 -0
  15. data/lib/metric_fu/formatter.rb +23 -0
  16. data/lib/metric_fu/formatter/html.rb +12 -9
  17. data/lib/metric_fu/initial_requires.rb +1 -0
  18. data/lib/metric_fu/io.rb +60 -1
  19. data/lib/metric_fu/load_files.rb +4 -2
  20. data/lib/metric_fu/loader.rb +62 -0
  21. data/lib/metric_fu/metric.rb +102 -0
  22. data/lib/metric_fu/metrics/base_template.rb +15 -9
  23. data/lib/metric_fu/metrics/cane/cane.rb +9 -5
  24. data/lib/metric_fu/metrics/cane/init.rb +35 -13
  25. data/lib/metric_fu/metrics/churn/churn.rb +5 -1
  26. data/lib/metric_fu/metrics/churn/init.rb +24 -4
  27. data/lib/metric_fu/metrics/flay/flay.rb +7 -3
  28. data/lib/metric_fu/metrics/flay/init.rb +29 -13
  29. data/lib/metric_fu/metrics/flay/template_awesome/flay.html.erb +1 -1
  30. data/lib/metric_fu/metrics/flog/flog.rb +14 -38
  31. data/lib/metric_fu/metrics/flog/init.rb +30 -7
  32. data/lib/metric_fu/metrics/generator.rb +21 -6
  33. data/lib/metric_fu/metrics/graph.rb +2 -2
  34. data/lib/metric_fu/metrics/hotspots/hotspots.rb +5 -1
  35. data/lib/metric_fu/metrics/hotspots/init.rb +21 -5
  36. data/lib/metric_fu/metrics/rails_best_practices/init.rb +29 -5
  37. data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices.rb +20 -27
  38. data/lib/metric_fu/metrics/rails_best_practices/template_awesome/rails_best_practices.html.erb +1 -1
  39. data/lib/metric_fu/metrics/rcov/init.rb +40 -15
  40. data/lib/metric_fu/metrics/rcov/rcov.rb +15 -10
  41. data/lib/metric_fu/metrics/reek/init.rb +25 -6
  42. data/lib/metric_fu/metrics/reek/reek.rb +52 -31
  43. data/lib/metric_fu/metrics/reek/template_awesome/reek.html.erb +1 -1
  44. data/lib/metric_fu/metrics/roodi/init.rb +25 -6
  45. data/lib/metric_fu/metrics/roodi/roodi.rb +7 -3
  46. data/lib/metric_fu/metrics/saikuro/init.rb +22 -6
  47. data/lib/metric_fu/metrics/saikuro/saikuro.rb +8 -3
  48. data/lib/metric_fu/metrics/stats/init.rb +28 -5
  49. data/lib/metric_fu/metrics/stats/stats.rb +24 -6
  50. data/lib/metric_fu/metrics/stats/template_awesome/stats.html.erb +2 -2
  51. data/lib/metric_fu/parser_ext.rb +15 -0
  52. data/lib/metric_fu/reporting/graphs/engines/gchart.rb +1 -1
  53. data/lib/metric_fu/reporting/graphs/engines/init.rb +18 -4
  54. data/lib/metric_fu/reporting/graphs/grapher.rb +1 -1
  55. data/lib/metric_fu/reporting/result.rb +13 -6
  56. data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +1 -1
  57. data/lib/metric_fu/run.rb +7 -10
  58. data/lib/metric_fu/sexp_ext.rb +11 -0
  59. data/lib/metric_fu/version.rb +1 -1
  60. data/metric_fu.gemspec +23 -20
  61. data/spec/cli/helper_spec.rb +5 -16
  62. data/spec/metric_fu/configuration_spec.rb +62 -88
  63. data/spec/metric_fu/formatter/html_spec.rb +26 -16
  64. data/spec/metric_fu/formatter/yaml_spec.rb +2 -2
  65. data/spec/metric_fu/metric_spec.rb +50 -0
  66. data/spec/metric_fu/metrics/base_template_spec.rb +9 -7
  67. data/spec/metric_fu/metrics/cane/cane_spec.rb +19 -24
  68. data/spec/metric_fu/metrics/churn/churn_spec.rb +8 -8
  69. data/spec/metric_fu/metrics/flay/flay_spec.rb +7 -13
  70. data/spec/metric_fu/metrics/flog/flog_spec.rb +63 -58
  71. data/spec/metric_fu/metrics/generator_spec.rb +4 -0
  72. data/spec/metric_fu/metrics/hotspots/hotspots_spec.rb +7 -7
  73. data/spec/metric_fu/metrics/rails_best_practices/rails_best_practices_spec.rb +14 -33
  74. data/spec/metric_fu/metrics/rcov/rcov_spec.rb +17 -18
  75. data/spec/metric_fu/metrics/reek/reek_spec.rb +9 -10
  76. data/spec/metric_fu/metrics/roodi/roodi_spec.rb +5 -11
  77. data/spec/metric_fu/metrics/saikuro/saikuro_spec.rb +15 -14
  78. data/spec/metric_fu/metrics/stats/stats_spec.rb +5 -6
  79. data/spec/metric_fu/reporting/graphs/engines/bluff_spec.rb +2 -3
  80. data/spec/metric_fu/reporting/graphs/engines/gchart_spec.rb +12 -9
  81. data/spec/metric_fu/reporting/result_spec.rb +3 -3
  82. data/spec/run_spec.rb +45 -29
  83. data/spec/spec_helper.rb +7 -0
  84. data/spec/support/helper_methods.rb +9 -0
  85. data/spec/support/suite.rb +17 -11
  86. metadata +59 -56
  87. data/bin/mf-rails_best_practices +0 -9
  88. data/bin/mf-stats +0 -7
@@ -0,0 +1,88 @@
1
+ require 'redcard'
2
+ MetricFu.logging_require { 'mf_debugger' }
3
+ module MetricFu
4
+ module Environment
5
+
6
+ # TODO: Set log_level here, instead
7
+ def verbose
8
+ MfDebugger::Logger.debug_on
9
+ end
10
+
11
+ def verbose=(toggle)
12
+ MfDebugger::Logger.debug_on = toggle
13
+ end
14
+
15
+ # Perform a simple check to try and guess if we're running
16
+ # against a rails app.
17
+ #
18
+ # TODO This should probably be made a bit more robust.
19
+ def rails?
20
+ @rails ||= begin
21
+ exists = File.exist?("config/environment.rb")
22
+ def MetricFu.rails?
23
+ exists
24
+ end
25
+ exists
26
+ end
27
+ end
28
+
29
+ def is_cruise_control_rb?
30
+ !!ENV['CC_BUILD_ARTIFACTS']
31
+ end
32
+
33
+ def jruby?
34
+ @jruby ||= !!RedCard.check(:jruby)
35
+ end
36
+
37
+ def mri?
38
+ @mri ||= !!RedCard.check(:ruby)
39
+ end
40
+
41
+ def ruby_flavor
42
+ @ruby_flavor ||= RedCard.engine
43
+ end
44
+
45
+ def ruby_version
46
+ @ruby_version ||= RedCard.engine_version
47
+ end
48
+
49
+ def ruby18?
50
+ @ruby18 ||= mri? && !!RedCard.check('1.8'...'1.9')
51
+ end
52
+
53
+ def ruby192?
54
+ @ruby192 ||= mri? && ruby_version == '1.9.2'
55
+ end
56
+
57
+ def rubinius?
58
+ @rubinius ||= !!RedCard.check(:rubinius)
59
+ end
60
+
61
+ def supports_ripper?
62
+ @supports_ripper ||= begin
63
+ require 'ripper'
64
+ true
65
+ rescue LoadError
66
+ false
67
+ end
68
+ end
69
+ def platform #:nodoc:
70
+ return RUBY_PLATFORM
71
+ end
72
+
73
+ def osx?
74
+ @osx ||= platform.include?('darwin')
75
+ end
76
+
77
+ def ruby_strangely_makes_accessors_private?
78
+ ruby192? || jruby?
79
+ end
80
+
81
+ # HACK: for using this module via inclusion in Configuration
82
+ def self.included(host_class)
83
+ def host_class.ruby_strangely_makes_accessors_private?
84
+ @private_accessors ||= allocate.ruby_strangely_makes_accessors_private?
85
+ end
86
+ end
87
+ end
88
+ end
@@ -20,5 +20,28 @@ module MetricFu
20
20
 
21
21
  end
22
22
 
23
+ module Templates
24
+ MetricFu.reporting_require { 'templates/awesome/awesome_template' }
25
+
26
+ module_function
27
+
28
+ def options
29
+ @options ||= {}
30
+ end
31
+ def option(name)
32
+ options.fetch(name) { raise "No such template option: #{name}" }
33
+ end
34
+
35
+ # TODO: Remove config argument
36
+ def configure_template(config)
37
+ @options = {}
38
+ @options['template_class'] = AwesomeTemplate
39
+ @options['link_prefix'] = nil
40
+ @options['darwin_txmt_protocol_no_thanks'] = true
41
+ # # turning off syntax_highlighting may avoid some UTF-8 issues
42
+ @options['syntax_highlighting'] = true
43
+ end
44
+
45
+ end
23
46
  end
24
47
  end
@@ -9,12 +9,13 @@ module MetricFu
9
9
 
10
10
  def finish
11
11
  mf_log "** SAVING REPORTS"
12
- mf_debug "** SAVING REPORT YAML OUTPUT TO #{MetricFu.base_directory}"
12
+ mf_debug "** SAVING REPORT YAML OUTPUT TO #{MetricFu::Io::FileSystem.directory('base_directory')}"
13
13
  MetricFu::Formatter::YAML.new.finish
14
14
 
15
- mf_debug "** SAVING REPORT DATA OUTPUT TO #{MetricFu.data_directory}"
15
+ mf_debug "** SAVING REPORT DATA OUTPUT TO #{MetricFu::Io::FileSystem.directory('data_directory')}"
16
+ # TODO: Allow customizing output filenames
16
17
  MetricFu::Formatter::YAML.new(
17
- output: Pathname.pwd.join("#{MetricFu.data_directory}/#{Time.now.strftime("%Y%m%d")}.yml")
18
+ output: Pathname.pwd.join("#{MetricFu::Io::FileSystem.directory('data_directory')}/#{Time.now.strftime("%Y%m%d")}.yml")
18
19
  ).finish
19
20
 
20
21
  mf_debug "** SAVING TEMPLATIZED REPORT"
@@ -36,7 +37,7 @@ module MetricFu
36
37
  protected
37
38
 
38
39
  def output_directory
39
- @output ||= dir_for(@options[:output]) || Pathname.pwd.join(MetricFu.output_directory)
40
+ @output ||= dir_for(@options[:output]) || Pathname.pwd.join(MetricFu::Io::FileSystem.directory('output_directory'))
40
41
  end
41
42
 
42
43
  # Instantiates a new template class based on the configuration set
@@ -45,7 +46,7 @@ module MetricFu
45
46
  # assigns the result_hash to the result_hash in the template, and
46
47
  # tells the template to to write itself out.
47
48
  def save_templatized_result
48
- @template = MetricFu.template_class.new
49
+ @template = MetricFu::Formatter::Templates.option('template_class').new
49
50
  @template.output_directory = self.output_directory
50
51
  @template.result = MetricFu.result.result_hash
51
52
  @template.per_file_data = MetricFu.result.per_file_data
@@ -56,9 +57,11 @@ module MetricFu
56
57
  def save_graphs
57
58
  mf_log "** GENERATING GRAPHS"
58
59
  mf_debug "** PREPARING TO GRAPH"
59
- MetricFu.graphs.each {|graph|
60
- mf_debug "** Graphing #{graph} with #{MetricFu.graph_engine}"
61
- MetricFu.graph.add(graph, MetricFu.graph_engine, self.output_directory)
60
+ MetricFu.configuration.graphs.each {|graph|
61
+ mf_debug "** Graphing #{graph} with #{MetricFu.configuration.graph_engine}"
62
+ # TODO: This should probably be defined on configuration
63
+ # rather than the module. See MetricFu::Graph
64
+ MetricFu.graph.add(graph, MetricFu.configuration.graph_engine, self.output_directory)
62
65
  }
63
66
  mf_debug "** GENERATING GRAPH"
64
67
  MetricFu.graph.generate
@@ -73,7 +76,7 @@ module MetricFu
73
76
  # @return Boolean
74
77
  # Should we open in the browser or not?
75
78
  def open_in_browser?
76
- MetricFu.configuration.platform.include?('darwin') &&
79
+ MetricFu.configuration.osx? &&
77
80
  ! MetricFu.configuration.is_cruise_control_rb?
78
81
  end
79
82
 
@@ -8,6 +8,7 @@ require 'redcard'
8
8
  require 'multi_json'
9
9
 
10
10
  MetricFu.configure
11
+ MetricFu.lib_require { 'parser_ext' }
11
12
  MetricFu.logging_require { 'mf_debugger' }
12
13
  include MfDebugger
13
14
  MfDebugger::Logger.debug_on = !!(ENV['MF_DEBUG'] =~ /true/i)
data/lib/metric_fu/io.rb CHANGED
@@ -1,5 +1,64 @@
1
+ require 'fileutils'
1
2
  module MetricFu
2
3
  module Io
4
+ # TODO: Move this module / functionality elsewhere and make less verbose
5
+ module FileSystem
6
+
7
+ # TODO: Use a better environmental variable name for the output / artiface dir. Set to a different default in tests.
8
+ def self.artifact_dir
9
+ (ENV['CC_BUILD_ARTIFACTS'] || 'tmp/metric_fu')
10
+ end
11
+
12
+ module_function
13
+
14
+ def directories
15
+ @directories ||= {}
16
+ end
17
+
18
+ def directory(name)
19
+ directories.fetch(name) { raise "No such directory configured: #{name}" }
20
+ end
21
+ def file_globs_to_ignore
22
+ @file_globs_to_ignore ||= []
23
+ end
24
+
25
+ # TODO: Remove call to config
26
+ def set_directories(config)
27
+ @directories = {}
28
+ @directories['base_directory'] = MetricFu.artifact_dir
29
+ @directories['scratch_directory'] = MetricFu.scratch_dir
30
+ @directories['output_directory'] = MetricFu.output_dir
31
+ @directories['data_directory'] = MetricFu.data_dir
32
+ create_directories @directories.values
33
+
34
+ @directories['root_directory'] = MetricFu.root_dir
35
+ # TODO Though this is true of the general AwesomeTemplate, it is not necessarily true of templates within each Metric. Each metric should probably know how to use AwesomeTemplate (or whatever)
36
+ @directories['template_directory'] = File.join(@directories.fetch('root_directory'), 'lib', 'templates')
37
+ @file_globs_to_ignore = []
38
+ set_code_dirs(config)
39
+ end
40
+
41
+ def create_directories(*dirs)
42
+ # due to behavior differences between ruby 1.8.7 and 1.9.3
43
+ # this is good enough for now
44
+ Array(*dirs).each do |dir|
45
+ FileUtils.mkdir_p dir
46
+ end
47
+ end
48
+
49
+ # Add the 'app' directory if we're running within rails.
50
+ def set_code_dirs(config)
51
+ # TODO: Rather than check if we're running against a rails app,
52
+ # shouldn't we just check if the directories exist?
53
+ if config.rails?
54
+ @directories['code_dirs'] = %w(app lib)
55
+ else
56
+ @directories['code_dirs'] = %w(lib)
57
+ end
58
+ end
59
+
60
+ end
61
+
3
62
  # Writes the output to a file or io stream.
4
63
  # @param output [String, #to_s] the content to write.
5
64
  # @param path_or_io [String, #to_s, IO, #write] a file path
@@ -62,7 +121,7 @@ module MetricFu
62
121
  end
63
122
 
64
123
  def path_relative_to_base(path)
65
- pathname = Pathname.pwd.join(MetricFu.base_directory) # make full path relative to base directory
124
+ pathname = Pathname.pwd.join(MetricFu::Io::FileSystem.directory('base_directory')) # make full path relative to base directory
66
125
  pathname.join(path)
67
126
  end
68
127
  end
@@ -6,8 +6,10 @@ MetricFu.metrics_require { 'graph' }
6
6
  MetricFu.reporting_require { 'graphs/grapher' }
7
7
  MetricFu.metrics_require { 'hotspots/analysis/scoring_strategies' }
8
8
 
9
- Dir.glob(File.join(MetricFu.lib_dir, '*.rb')).reject{|file| file =~ /#{__FILE__}/}.each do |file|
10
- require file
9
+ Dir.glob(File.join(MetricFu.lib_dir, '*.rb')).
10
+ reject{|file| file =~ /#{__FILE__}|ext.rb/}.
11
+ each do |file|
12
+ require file
11
13
  end
12
14
  # prevent the task from being run multiple times.
13
15
  unless Rake::Task.task_defined? "metrics:all"
@@ -0,0 +1,62 @@
1
+ module MetricFu
2
+ class Loader
3
+ # TODO: This class mostly serves to clean up the base MetricFu module,
4
+ # but needs further work
5
+
6
+ attr_reader :loaded_files
7
+ def initialize(lib_root)
8
+ @lib_root = lib_root
9
+ @loaded_files = []
10
+ end
11
+
12
+ def lib_require(base='',&block)
13
+ paths = []
14
+ base_path = File.join(@lib_root, base)
15
+ Array((yield paths, base_path)).each do |path|
16
+ file = File.join(base_path, *Array(path))
17
+ require file
18
+ if @loaded_files.include?(file)
19
+ puts "!!!\tAlready loaded #{file}" if !!(ENV['MF_DEBUG'] =~ /true/i)
20
+ else
21
+ @loaded_files << file
22
+ end
23
+ end
24
+ end
25
+
26
+ # TODO: Reduce duplication of directory logic
27
+ def create_dirs(klass)
28
+ class << klass
29
+ Array(yield).each do |dir|
30
+ define_method("#{dir}_dir") do
31
+ File.join(lib_dir,dir)
32
+ end
33
+ module_eval(%Q(def #{dir}_require(&block); lib_require('#{dir}', &block); end))
34
+ end
35
+ end
36
+ end
37
+
38
+ def create_artifact_subdirs(klass)
39
+ class << klass
40
+ Array(yield).each do |dir|
41
+ define_method("#{dir.gsub(/[^A-Za-z0-9]/,'')}_dir") do
42
+ File.join(artifact_dir,dir)
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ def load_tasks(tasks_relative_path)
49
+ load File.join(@lib_root, 'tasks', *Array(tasks_relative_path))
50
+ end
51
+
52
+ def setup
53
+ MetricFu.lib_require { 'configuration' }
54
+ MetricFu.lib_require { 'metric' }
55
+ # TODO: consolidate these setup files
56
+ MetricFu.lib_require { 'initial_requires' }
57
+ # Load a few things to make our lives easier elsewhere.
58
+ MetricFu.lib_require { 'load_files' }
59
+ end
60
+ end
61
+ end
62
+
@@ -0,0 +1,102 @@
1
+ require 'set'
2
+ # Encapsulates the configuration options for each metric
3
+ module MetricFu
4
+ class Metric
5
+
6
+ attr_accessor :enabled, :activated
7
+
8
+ def initialize
9
+ self.enabled = false
10
+ @libraries = Set.new
11
+ @configured_run_options = {}
12
+ end
13
+
14
+ def enable
15
+ self.enabled = true
16
+ end
17
+
18
+ # TODO: Confirm this catches load errors from requires in subclasses, such as for flog
19
+ def activate
20
+ @libraries.each {|library| require(library) }
21
+ self.activated = true
22
+ rescue LoadError => e
23
+ MetricFu.configuration.mf_log("#{name} metric not activated, #{e.message}")
24
+ end
25
+
26
+ # @return metric name [Symbol]
27
+ def name
28
+ not_implemented
29
+ end
30
+
31
+ # @return metric run options [Hash]
32
+ def run_options
33
+ default_run_options.merge(configured_run_options)
34
+ end
35
+
36
+ def configured_run_options
37
+ @configured_run_options
38
+ end
39
+
40
+ # @return default metric run options [Hash]
41
+ def default_run_options
42
+ not_implemented
43
+ end
44
+
45
+ # @return metric_options [Hash]
46
+ def has_graph?
47
+ not_implemented
48
+ end
49
+
50
+ @metrics = []
51
+ # @return all subclassed metrics [Array<MetricFu::Metric>]
52
+ # ensure :hotspots runs last
53
+ def self.metrics
54
+ @metrics
55
+ end
56
+
57
+ def self.enabled_metrics
58
+ metrics.select{|metric| metric.enabled && metric.activated}.sort_by {|metric| metric.name == :hotspots ? 1 : 0 }
59
+ end
60
+
61
+ def self.get_metric(name)
62
+ metrics.find{|metric|metric.name.to_s == name.to_s}
63
+ end
64
+
65
+ def self.inherited(subclass)
66
+ @metrics << subclass.new
67
+ end
68
+
69
+ protected
70
+
71
+ # Enable using a syntax such as metric.foo = 'foo'
72
+ # by catching the missing method here,
73
+ # checking if :foo is a key in the default_run_options, and
74
+ # setting the key/value in the @configured_run_options hash
75
+ # TODO: See if we can do this without a method_missing
76
+ def method_missing(method, *args)
77
+ key = method_to_attr(method)
78
+ if default_run_options.has_key?(key)
79
+ configured_run_options[key] = args.first
80
+ else
81
+ raise "#{key} is not a valid configuration option"
82
+ end
83
+ end
84
+
85
+ # Used above to identify the stem of a setter method
86
+ def method_to_attr(method)
87
+ method.to_s.sub(/=$/, '').to_sym
88
+ end
89
+
90
+ private
91
+
92
+ def not_implemented
93
+ raise "Required method #{caller[0]} not implemented in #{__FILE__}"
94
+ end
95
+
96
+ def activate_library(file)
97
+ @libraries << file.strip
98
+ end
99
+
100
+
101
+ end
102
+ end
@@ -14,7 +14,7 @@ module MetricFu
14
14
 
15
15
 
16
16
  def output_directory
17
- @output_directory || MetricFu.output_directory
17
+ @output_directory || MetricFu::Io::FileSystem.directory('output_directory')
18
18
  end
19
19
 
20
20
 
@@ -56,7 +56,9 @@ module MetricFu
56
56
  # @return String
57
57
  # A file path
58
58
  def template(section)
59
- if MetricFu.metrics.include?(section) # expects a symbol
59
+ # TODO: each MetricFu::Metric should know about its templates
60
+ # This class knows too much about the filesystem structure
61
+ if MetricFu::Metric.enabled_metrics.map(&:name).include?(section) # expects a symbol
60
62
  File.join(template_dir(section.to_s), "#{section}.html.erb")
61
63
  else
62
64
  File.join(template_directory, section.to_s + ".html.erb")
@@ -156,7 +158,7 @@ module MetricFu
156
158
  def file_url(name, line) # :nodoc:
157
159
  return '' unless name
158
160
  filename = complete_file_path(name)
159
- link_prefix = MetricFu.configuration.link_prefix
161
+ link_prefix = MetricFu::Formatter::Templates.option('link_prefix')
160
162
  if link_prefix
161
163
  "#{link_prefix}/#{name.gsub(/:.*$/, '')}"
162
164
  elsif render_as_txmt_protocol?
@@ -176,14 +178,18 @@ module MetricFu
176
178
  filename.gsub(/^\//, '')
177
179
  end
178
180
  def render_as_txmt_protocol? # :nodoc:
179
- config = MetricFu.configuration
180
- return false unless config.platform.include?('darwin')
181
- return !config.darwin_txmt_protocol_no_thanks
181
+ if MetricFu.configuration.osx?
182
+ !MetricFu::Formatter::Templates.option('darwin_txmt_protocol_no_thanks')
183
+ else
184
+ false
185
+ end
182
186
  end
183
187
  def render_as_mvim_protocol? # :nodoc:
184
- config = MetricFu.configuration
185
- return false unless config.platform.include?('darwin')
186
- return !config.darwin_mvim_protocol_no_thanks
188
+ if MetricFu.configuration.osx?
189
+ !MetricFu::Formatter::Templates.option('darwin_mvim_protocol_no_thanks')
190
+ else
191
+ false
192
+ end
187
193
  end
188
194
 
189
195
  # Provides a brain dead way to cycle between two values during