From f03e7670cf1c04f36ca70eb1bf870f8bf69f5658 Mon Sep 17 00:00:00 2001 From: Nicolas McCurdy Date: Sat, 4 Jan 2014 20:39:44 -0500 Subject: [PATCH] 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. --- lib/homesick.rb | 4 +--- lib/homesick/actions.rb | 8 ++------ rubocop-todo.yml | 5 +---- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/homesick.rb b/lib/homesick.rb index 039de4a..c33bb8f 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -31,9 +31,7 @@ class Homesick < Thor destination = nil if File.exist?(uri) uri = Pathname.new(uri).expand_path - if uri.to_s.start_with?(repos_dir.to_s) - raise "Castle already cloned to #{uri}" - end + raise "Castle already cloned to #{uri}" if uri.to_s.start_with?(repos_dir.to_s) destination = uri.basename diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index b079325..e73ed4d 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -93,9 +93,7 @@ class Homesick if destination.exist? say_status :conflict, "#{destination} exists", :red unless options[:quiet] - if options[:force] || shell.file_collision(destination) { source } - system "mv '#{source}' '#{destination}'" unless options[:pretend] - end + system "mv '#{source}' '#{destination}'" if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend] else # this needs some sort of message here. system "mv '#{source}' '#{destination}'" unless options[:pretend] @@ -155,9 +153,7 @@ class Homesick else 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}'" unless options[:pretend] - end + system "ln -nsf '#{source}' '#{destination}'" if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend] end elsif destination.exist? say_status :conflict, "#{destination} exists", :red unless options[:quiet] diff --git a/rubocop-todo.yml b/rubocop-todo.yml index f7f8ebc..712dd03 100644 --- a/rubocop-todo.yml +++ b/rubocop-todo.yml @@ -5,11 +5,8 @@ BlockAlignment: Enabled: false -BlockNesting: - Max: 4 - ClassLength: - Max: 352 + Max: 350 CommentAnnotation: Enabled: false