Questions tagged [reek]

Reek, the code smell detector for Ruby

Reek is a tool that examines Ruby classes, modules and methods and reports any Code Smells it finds.

24 questions
1
vote
1 answer

Ruby's Reek quality check

I'm getting below error in my Robot class: Commands tests @robot.placed at least 4 times (RepeatedConditional) This is the problematic code that's causing it: def move @robot.move_forward if @robot.placed end def left @robot.left if…
Passionate Engineer
  • 10,034
  • 26
  • 96
  • 168
1
vote
3 answers

Reek codesmell Duplicate Method call fix

I'm getting below errors from reek: lib/actions.rb -- 5 warnings: Actions#move_forward calls (self.x_coordinate + unit) twice (DuplicateMethodCall) Actions#move_forward calls place((self.x_coordinate + unit), self.y_coordinate, self.direction)…
Passionate Engineer
  • 10,034
  • 26
  • 96
  • 168
0
votes
1 answer

Correctly configuring rubycritic and reek to ignore InstanceVariableAssumption

I have a .reek.yml file in the root of my rails app with the following content: directories: "app/controllers": InstanceVariableAssumption: enabled: false However, when I run the following command, rubycritic app lib, it doesn't seem to…
Kurt Mueller
  • 3,173
  • 2
  • 29
  • 50
0
votes
2 answers

Refactor ruby condition with params

I'd like to know if there is a simpler way to do this condition in ruby My Condition : a = params[:smth].to_s == 'foo' ? 'foo2' : params[:smth].to_s The problem of that condition, that reek throw warning of using params[:smth] 2 times, there is one…
0
votes
0 answers

Reek SublimeLinter Setup Issues

I've been trying to get the Reek Linter plugin working with Sublime Text 3 on my OSX machine and I'm having no luck. The plugin is called SublimeLinter-contrib-reek. I've followed the instructions on the package homepage and it's still not…
0
votes
2 answers

Should multiple array/hash lookups be stored in a variable

I've been using Reek lately to refactor my code and one of the smells, DuplicateMethodCall, is being called on array and hash lookups, such as array[1] or hash[:key] when called multiple times. So I was wondering if multiple array or hash lookups…
Maxim Fedotov
  • 1,349
  • 1
  • 18
  • 38
0
votes
1 answer

Why does Eclipse complain about "Feature envy" smell in my code?

Eclipse (RedRails) complain about "Feature envy" in the following code: if input_text =~ /^(---\s*\n.*?\n?)(---.*?)/m content_text = input_text[($1.size + $2.size)..-1] # warning in $1 header = YAML.load($1) @content = content_text.strip() …
Mike Chaliy
  • 25,801
  • 18
  • 67
  • 105
-1
votes
1 answer

No such file to load while running rake reek task

https://github.com/kevinrutherford/reek/wiki/Rake-Task I followed all the instructions in the above page to install the reek gem and run it, but I get the following error while running the rake reek task. rake reek rake aborted! no such file to load…
priya
  • 24,861
  • 26
  • 62
  • 81
-1
votes
1 answer

How to refactor case..when in Ruby

def readable uptime = (Time.now - self).to_i case uptime when 0 then 'just now' when 1 then 'uptime second ago' when 2..59 then uptime.to_s + ' seconds ago' when 60..119 then 'uptime minute ago' # 120 = 2 minutes when…
1
2