jenkins-bot has submitted this change and it was merged.

Change subject: Fixed Style/Next RuboCop offense
......................................................................


Fixed Style/Next RuboCop offense

More information is available at:

https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals

Bug: T106220
Change-Id: I8f8d0cc9172a98572bbb366ebdc8c9da26541b3a
---
M .rubocop_todo.yml
M Vagrantfile
M lib/mediawiki-vagrant/config.rb
M lib/mediawiki-vagrant/roles/info.rb
4 files changed, 22 insertions(+), 32 deletions(-)

Approvals:
  Dduvall: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 9342ea1..ec446ba 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,6 +1,6 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config`
-# on 2015-11-12 12:47:47 +0100 using RuboCop version 0.35.1.
+# on 2015-11-12 12:58:44 +0100 using RuboCop version 0.35.1.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
@@ -63,21 +63,6 @@
     - 'lib/mediawiki-vagrant/environment.rb'
     - 'lib/mediawiki-vagrant/roles/list.rb'
     - 'lib/mediawiki-vagrant/setup.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
-Style/Next:
-  Exclude:
-    - 'Vagrantfile'
-    - 'lib/mediawiki-vagrant/roles/info.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/RescueModifier:
-  Exclude:
-    - 'Vagrantfile'
-    - 'lib/mediawiki-vagrant/config.rb'
 
 # Offense count: 1
 # Configuration parameters: Methods.
diff --git a/Vagrantfile b/Vagrantfile
index 649cd76..446756a 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -254,14 +254,16 @@
 # Migrate {apt,composer}-cache to cache/{apt,composer}
 ['apt', 'composer'].each do |type|
   src = mwv.path("#{type}-cache")
+  next unless src.directory?
 
-  if src.directory?
-    dst = mwv.path('cache', type)
+  dst = mwv.path('cache', type)
 
-    src.each_child do |src_file|
-      unless src_file.directory? || src_file.basename.fnmatch?('.*')
-        src_file.rename(dst.join(src_file.basename)) rescue nil
-      end
+  src.each_child do |src_file|
+    next if src_file.directory? || src_file.basename.fnmatch?('.*')
+
+    begin
+      src_file.rename(dst.join(src_file.basename))
+    rescue
     end
   end
 end
diff --git a/lib/mediawiki-vagrant/config.rb b/lib/mediawiki-vagrant/config.rb
index dcab194..807748f 100644
--- a/lib/mediawiki-vagrant/config.rb
+++ b/lib/mediawiki-vagrant/config.rb
@@ -161,7 +161,11 @@
     # Current width of the terminal.
     #
     def screen_width
-      @screen_width ||= `tput cols`.chomp.to_i rescue 80
+      @screen_width ||= begin
+                          `tput cols`.chomp.to_i
+                        rescue
+                          80
+                        end
     end
 
     # Unsets the given settings.
diff --git a/lib/mediawiki-vagrant/roles/info.rb 
b/lib/mediawiki-vagrant/roles/info.rb
index 6477fd3..763f9c4 100644
--- a/lib/mediawiki-vagrant/roles/info.rb
+++ b/lib/mediawiki-vagrant/roles/info.rb
@@ -45,18 +45,17 @@
           @env.ui.info rd.convert(doc) if doc
 
           changes = @mwv.load_settings(@mwv.roles_enabled + [role]) - settings
+          next unless changes.any?
 
-          if changes.any?
-            @env.ui.warn 'Enabling this role will adjust the following 
settings:'
+          @env.ui.warn 'Enabling this role will adjust the following settings:'
 
-            changes.each do |setting, change|
-              cur, new = *change.map { |v| setting_display_value(v) }
+          changes.each do |setting, change|
+            cur, new = *change.map { |v| setting_display_value(v) }
 
-              @env.ui.info ''
-              @env.ui.info setting.description unless setting.description.nil?
-              @env.ui.info "#{setting.name}: #{cur} -> ", new_line: false
-              @env.ui.info "#{new}", bold: true
-            end
+            @env.ui.info ''
+            @env.ui.info setting.description unless setting.description.nil?
+            @env.ui.info "#{setting.name}: #{cur} -> ", new_line: false
+            @env.ui.info "#{new}", bold: true
           end
         end
 

-- 
To view, visit https://gerrit.wikimedia.org/r/252675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f8d0cc9172a98572bbb366ebdc8c9da26541b3a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to