Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/277801

Change subject: rubocop: Review todos
......................................................................

rubocop: Review todos

Change-Id: I677f30b1150a759d4e0c698af1d195c666a2bf6e
---
M .rubocop.yml
D .rubocop_todo.yml
M bin/doccomparer.rb
M bin/testsuitegenerator.rb
4 files changed, 19 insertions(+), 81 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/01/277801/1

diff --git a/.rubocop.yml b/.rubocop.yml
index c5b0c59..931c6ca 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,5 +1,3 @@
-inherit_from: .rubocop_todo.yml
-
 AllCops:
   Include:
     - 'bin/*.rb'
@@ -26,6 +24,10 @@
   Enabled: false
 
 # Opinions differ.
+Style/BlockDelimiters:
+  Enabled: false
+Style/ConditionalAssignment:
+  Enabled: false
 Style/NegatedIf:
   Enabled: false
 Style/Tab:
@@ -37,6 +39,8 @@
 Style/IndentationWidth:
   Enabled: false
 Style/MultilineOperationIndentation:
+  Enabled: false
+Style/MultilineMethodCallIndentation:
   Enabled: false
 Style/IfUnlessModifier:
   Enabled: false
@@ -68,6 +72,8 @@
 Style/WordArray:
   MinSize: 3
 
-# RuboCop bug causes false positives.
+# RuboCop bugs cause false positives (it just hates tabs with passion).
 Style/CommentIndentation:
   Enabled: false
+Style/IndentAssignment:
+  Enabled: false
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
deleted file mode 100644
index d0e4c22..0000000
--- a/.rubocop_todo.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# This configuration was generated by
-# `rubocop --auto-gen-config`
-# on 2016-03-16 13:16:59 +0000 using RuboCop version 0.36.0.
-# 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
-# versions of RuboCop, may require this file to be generated again.
-
-# Offense count: 10
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, 
FunctionalMethods, IgnoredMethods.
-# SupportedStyles: line_count_based, semantic, braces_for_chaining
-# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, 
new, realtime, tap, with_object
-# FunctionalMethods: let, let!, subject, watch
-# IgnoredMethods: lambda, proc, it
-Style/BlockDelimiters:
-  Exclude:
-    - 'bin/doccomparer.rb'
-    - 'bin/docparser.rb'
-    - 'bin/testsuitegenerator.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: SingleLineConditionsOnly.
-Style/ConditionalAssignment:
-  Exclude:
-    - 'bin/docparser.rb'
-
-# Offense count: 1
-Style/IfInsideElse:
-  Exclude:
-    - 'bin/doccomparer.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: IndentationWidth.
-Style/IndentAssignment:
-  Exclude:
-    - 'bin/docparser.rb'
-    - 'bin/testsuitegenerator.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/MethodCallParentheses:
-  Exclude:
-    - 'bin/testsuitegenerator.rb'
-
-# Offense count: 17
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: aligned, indented
-Style/MultilineMethodCallIndentation:
-  Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/ParallelAssignment:
-  Exclude:
-    - 'bin/doccomparer.rb'
-
-# Offense count: 7
-# Cop supports --auto-correct.
-# Configuration parameters: SupportedStyles, WordRegex.
-# SupportedStyles: percent, brackets
-Style/WordArray:
-  EnforcedStyle: percent
-  MinSize: 3
diff --git a/bin/doccomparer.rb b/bin/doccomparer.rb
index cd3623d..3a7cd31 100644
--- a/bin/doccomparer.rb
+++ b/bin/doccomparer.rb
@@ -105,7 +105,8 @@
                b_val = b ? canonicalize(b[key]) : nil
 
                if [a_val, b_val] == [{}, []] || [a_val, b_val] == [[], {}]
-                       a_val, b_val = {}, {}
+                       a_val = {}
+                       b_val = {}
                end
 
                if a_val.is_a?(Hash) && b_val.is_a?(Hash)
@@ -115,16 +116,14 @@
                        else
                                "#{key}: MISMATCH\n#{comparison_result}"
                        end
+               elsif a_val == b_val
+                       "#{key}: match" if $VERBOSE
+               elsif a_val.nil?
+                       "#{key}: #{a_name} missing"
+               elsif b_val.nil?
+                       "#{key}: #{b_name} missing"
                else
-                       if a_val == b_val
-                               "#{key}: match" if $VERBOSE
-                       elsif a_val.nil?
-                               "#{key}: #{a_name} missing"
-                       elsif b_val.nil?
-                               "#{key}: #{b_name} missing"
-                       else
-                               "#{key}: MISMATCH\n  #{a_name}: 
#{a_val.inspect}\n  #{b_name}: #{b_val.inspect}"
-                       end
+                       "#{key}: MISMATCH\n  #{a_name}: #{a_val.inspect}\n  
#{b_name}: #{b_val.inspect}"
                end
        end
        out.compact.join "\n"
diff --git a/bin/testsuitegenerator.rb b/bin/testsuitegenerator.rb
index 4416c84..100054e 100644
--- a/bin/testsuitegenerator.rb
+++ b/bin/testsuitegenerator.rb
@@ -128,7 +128,7 @@
                                        values.map{|v| 
config_option.dup.merge(value: v) } + [nil]
                                end
                        }
-                       expanded.length > 0 ? 
expanded[0].product(*expanded[1..-1]) : []
+                       expanded.empty? ? [] : 
expanded[0].product(*expanded[1..-1])
                }.inject(:concat).map(&:compact).uniq
 
                # really require the required ones

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I677f30b1150a759d4e0c698af1d195c666a2bf6e
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to