Fix an issue reported by rubocop that wasn't ignored in the todo config

Issue text: Favor modifier if/unless usage when you have a single-line body.
This commit is contained in:
Nicolas McCurdy
2014-01-04 20:39:44 -05:00
parent e202b7eae7
commit f03e7670cf
3 changed files with 4 additions and 13 deletions

View File

@@ -31,9 +31,7 @@ class Homesick < Thor
destination = nil destination = nil
if File.exist?(uri) if File.exist?(uri)
uri = Pathname.new(uri).expand_path uri = Pathname.new(uri).expand_path
if uri.to_s.start_with?(repos_dir.to_s) raise "Castle already cloned to #{uri}" if uri.to_s.start_with?(repos_dir.to_s)
raise "Castle already cloned to #{uri}"
end
destination = uri.basename destination = uri.basename

View File

@@ -93,9 +93,7 @@ class Homesick
if destination.exist? if destination.exist?
say_status :conflict, "#{destination} exists", :red unless options[:quiet] say_status :conflict, "#{destination} exists", :red unless options[:quiet]
if options[:force] || shell.file_collision(destination) { source } system "mv '#{source}' '#{destination}'" if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend]
system "mv '#{source}' '#{destination}'" unless options[:pretend]
end
else else
# this needs some sort of message here. # this needs some sort of message here.
system "mv '#{source}' '#{destination}'" unless options[:pretend] system "mv '#{source}' '#{destination}'" unless options[:pretend]
@@ -155,9 +153,7 @@ class Homesick
else else
say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red unless options[:quiet] say_status :conflict, "#{destination} exists and points to #{destination.readlink}", :red unless options[:quiet]
if options[:force] || shell.file_collision(destination) { source } system "ln -nsf '#{source}' '#{destination}'" if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend]
system "ln -nsf '#{source}' '#{destination}'" unless options[:pretend]
end
end end
elsif destination.exist? elsif destination.exist?
say_status :conflict, "#{destination} exists", :red unless options[:quiet] say_status :conflict, "#{destination} exists", :red unless options[:quiet]

View File

@@ -5,11 +5,8 @@
BlockAlignment: BlockAlignment:
Enabled: false Enabled: false
BlockNesting:
Max: 4
ClassLength: ClassLength:
Max: 352 Max: 350
CommentAnnotation: CommentAnnotation:
Enabled: false Enabled: false