From 19491cec2179fbeef3c1318d65db11710d840e7e Mon Sep 17 00:00:00 2001 From: Yurii Dubinka Date: Fri, 26 Mar 2021 01:39:38 +0200 Subject: [PATCH] #355: Update rubocop requirement from = 1.11.0 to = 1.12.0 Fixed #355 --- .rubocop.yml | 1 + lib/lazylead/cc.rb | 38 +++++++++++--------------- lib/lazylead/model.rb | 12 ++++---- lib/lazylead/task/accuracy/accuracy.rb | 12 ++++---- lib/lazylead/task/accuracy/onlyll.rb | 12 ++++---- 5 files changed, 32 insertions(+), 43 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 77be746..807823e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,7 @@ require: - rubocop-performance AllCops: + NewCops: enable DisplayCopNames: true DisplayStyleGuide: true TargetRubyVersion: 2.6 diff --git a/lib/lazylead/cc.rb b/lib/lazylead/cc.rb index c3bf86d..250b661 100644 --- a/lib/lazylead/cc.rb +++ b/lib/lazylead/cc.rb @@ -80,13 +80,11 @@ def initialize(text, regxp = /[^\s]@[^\s]/) end def cc - @cc ||= begin - if @text.include? "," - @text.split(",").map(&:strip).select { |e| e[@regxp] } - elsif @text[@regxp] - [@text.strip] - end - end + @cc ||= if @text.include? "," + @text.split(",").map(&:strip).select { |e| e[@regxp] } + elsif @text[@regxp] + [@text.strip] + end end def each(&block) @@ -125,15 +123,13 @@ def cc(*names) end def to_h - @to_h ||= begin - if @orig.is_a? Hash - @orig.each_with_object({}) do |i, o| - o[i.first] = Lazylead::PlainCC.new(i.last).cc - end - else - {} - end - end + @to_h ||= if @orig.is_a? Hash + @orig.each_with_object({}) do |i, o| + o[i.first] = Lazylead::PlainCC.new(i.last).cc + end + else + {} + end end end @@ -151,12 +147,10 @@ def initialize(prj, jira) end def to_h - @to_h ||= begin - components.each_with_object({}) do |c, h| - email = lead(c.attrs["id"]) - next if email.nil? || email.blank? - h[c.attrs["name"]] = email - end + @to_h ||= components.each_with_object({}) do |c, h| + email = lead(c.attrs["id"]) + next if email.nil? || email.blank? + h[c.attrs["name"]] = email end end diff --git a/lib/lazylead/model.rb b/lib/lazylead/model.rb index 638feb3..0541fdd 100644 --- a/lib/lazylead/model.rb +++ b/lib/lazylead/model.rb @@ -135,13 +135,11 @@ def detect_cc(sys) end def props - @props ||= begin - if team.nil? - Opts.new(env(to_hash)) - else - Opts.new(env(team.to_hash.merge(to_hash))) - end - end + @props ||= if team.nil? + Opts.new(env(to_hash)) + else + Opts.new(env(team.to_hash.merge(to_hash))) + end end def postman diff --git a/lib/lazylead/task/accuracy/accuracy.rb b/lib/lazylead/task/accuracy/accuracy.rb index 9a653a5..8f14506 100644 --- a/lib/lazylead/task/accuracy/accuracy.rb +++ b/lib/lazylead/task/accuracy/accuracy.rb @@ -118,13 +118,11 @@ def color end def colors - @colors ||= begin - JSON.parse(@opts["colors"]) - .to_h - .to_a - .each { |e| e[0] = e[0].to_i } - .sort_by { |e| e[0] } - end + @colors ||= JSON.parse(@opts["colors"]) + .to_h + .to_a + .each { |e| e[0] = e[0].to_i } + .sort_by { |e| e[0] } end # Calculate grade for accuracy diff --git a/lib/lazylead/task/accuracy/onlyll.rb b/lib/lazylead/task/accuracy/onlyll.rb index 1231808..02398e1 100644 --- a/lib/lazylead/task/accuracy/onlyll.rb +++ b/lib/lazylead/task/accuracy/onlyll.rb @@ -94,13 +94,11 @@ def to_l(history) # Detect the percentage grid for tickets, by default its 0%, 10%, 20%, etc. def grid - @grid ||= begin - if @opts.key? "grid" - @opts.slice("grid", ",") - else - %w[0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%] - end - end + @grid ||= if @opts.key? "grid" + @opts.slice("grid", ",") + else + %w[0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%] + end end # Remove score labels from the ticket.