Skip to content

Commit

Permalink
Require reek with version 3.0.0 or later
Browse files Browse the repository at this point in the history
  • Loading branch information
obfuscoder committed Feb 5, 2016
1 parent 6487e77 commit 46b43d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ source "https://rubygems.org"
if RUBY_VERSION == "1.9.2"
# because of https://github.com/railsbp/rails_best_practices/blob/master/rails_best_practices.gemspec
gem "activesupport", "~> 3.2"
# because of https://github.com/troessner/reek/issues/334
gem "reek", "~> 1.4.0"

This comment has been minimized.

Copy link
@bf4

bf4 Feb 5, 2016

this is just for ruby 1.9.2

This comment has been minimized.

Copy link
@obfuscoder

obfuscoder Feb 6, 2016

Author Owner

When using reek 3.0+ the unparser dependency is gone.

# rbp -> as -> i18n
gem 'i18n', '0.6.11'
gem "parallel", "= 1.3.3" # 1.3.4 disallows 1.9.2
Expand Down
6 changes: 3 additions & 3 deletions lib/metric_fu/metrics/reek/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def emit
end
end

def run!(files, config_files)
examiner.new(files, config_files)
def run!(files, _config_files)

This comment has been minimized.

Copy link
@bf4

bf4 Feb 5, 2016

any reason you're no longer using the config_files?

This comment has been minimized.

Copy link
@obfuscoder

obfuscoder Feb 6, 2016

Author Owner

The configuration has changed quite a bit and I could not figure out a quick way to handle this properly. There is probably a way to do it.

files.map { |file| examiner.new(Pathname.new(file), []) }
end

def analyze
@matches = @output.smells.group_by(&:source).collect do |file_path, smells|
@matches = @output.map(&:smells).flatten.group_by(&:source).collect do |file_path, smells|
{ file_path: file_path,
code_smells: analyze_smells(smells) }
end
Expand Down
2 changes: 1 addition & 1 deletion metric_fu.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "flay", [">= 2.0.1", "~> 2.1"]
s.add_runtime_dependency "churn", ["~> 0.0.35"]
s.add_runtime_dependency "flog", [">= 4.1.1", "~> 4.1"]
s.add_runtime_dependency "reek", [">= 1.3.4", "< 3.0"]
s.add_runtime_dependency "reek", [">= 3.0.0"]

This comment has been minimized.

Copy link
@bf4

bf4 Feb 5, 2016

I'd rather extend the dependency than break it. Can you just change the upper bound?

This comment has been minimized.

Copy link
@obfuscoder

obfuscoder Feb 6, 2016

Author Owner

The interface has changed in version 3.0. So I would need to detect the different interfaces and have two integration implementations. I'm not sure if you would like such a maintenance hell in the metric_fu code. Is there a good reason for allowing the use of the old reek version? Wouldn't everyone want to use the latest version?

This comment has been minimized.

Copy link
@bf4

bf4 via email Feb 7, 2016

s.add_runtime_dependency "cane", [">= 2.5.2", "~> 2.5"]
s.add_runtime_dependency "rails_best_practices", [">= 1.14.3", "~> 1.14"]
s.add_runtime_dependency "metric_fu-Saikuro", [">= 1.1.3", "~> 1.1"]
Expand Down
9 changes: 6 additions & 3 deletions spec/metric_fu/metrics/reek/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
lines: [6, 9])
]
@lines = instance_double(@examiner, smells: @smells)
@reek.instance_variable_set(:@output, @lines)
@output = [@lines]
@reek.instance_variable_set(:@output, @output)
@matches = @reek.analyze
end

Expand Down Expand Up @@ -144,7 +145,8 @@
lines: [2, 4]),
]
@lines = instance_double(@examiner, smells: @smells)
@reek.instance_variable_set(:@output, @lines)
@output = [@lines]
@reek.instance_variable_set(:@output, @output)
@matches = @reek.analyze
end

Expand All @@ -157,7 +159,8 @@
context "without reek warnings" do
before :each do
@lines = instance_double(@examiner, smells: [])
@reek.instance_variable_set(:@output, @lines)
@output = [@lines]
@reek.instance_variable_set(:@output, @output)
@matches = @reek.analyze
end

Expand Down

0 comments on commit 46b43d7

Please sign in to comment.