From d272b2e2a2b4d5fc9341013b31e524bb986811df Mon Sep 17 00:00:00 2001 From: Laust Rud Jacobsen Date: Mon, 12 Oct 2015 22:01:40 +0200 Subject: [PATCH] Rubocop: remove redundant self. calls --- .rubocop_todo.yml | 12 +----------- app/models/app.rb | 10 +++++----- app/models/issue_tracker.rb | 4 ++-- app/models/notification_service.rb | 2 +- app/models/problem.rb | 2 +- lib/configurator.rb | 2 +- 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7200eff..09555dd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,7 +13,7 @@ Metrics/AbcSize: # Offense count: 5 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 205 + Max: 206 # Offense count: 5 Metrics/CyclomaticComplexity: @@ -363,16 +363,6 @@ Style/Proc: Style/RaiseArgs: Enabled: false -# Offense count: 13 -# Cop supports --auto-correct. -Style/RedundantSelf: - Exclude: - - 'app/models/app.rb' - - 'app/models/issue_tracker.rb' - - 'app/models/notification_service.rb' - - 'app/models/problem.rb' - - 'lib/configurator.rb' - # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. diff --git a/app/models/app.rb b/app/models/app.rb index 3d87ee0..e0d9002 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -106,11 +106,11 @@ class App alias_method :notify_on_deploys?, :notify_on_deploys def repo_branch - self.repository_branch.present? ? self.repository_branch : 'master' + repository_branch.present? ? repository_branch : 'master' end def github_repo? - self.github_repo.present? + github_repo.present? end def github_url @@ -122,7 +122,7 @@ class App end def bitbucket_repo? - self.bitbucket_repo.present? + bitbucket_repo.present? end def bitbucket_url @@ -157,12 +157,12 @@ class App if (copy_app = App.where(:_id => app_id).first) # Copy fields (copy_app.fields.keys - %w(_id name created_at updated_at)).each do |k| - self.send("#{k}=", copy_app.send(k)) + send("#{k}=", copy_app.send(k)) end # Clone the embedded objects that can be changed via apps/edit (ignore errs & deploys, etc.) %w(watchers issue_tracker notification_service).each do |relation| if (obj = copy_app.send(relation)) - self.send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone) + send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone) end end end diff --git a/app/models/issue_tracker.rb b/app/models/issue_tracker.rb index b146748..6c45fe4 100644 --- a/app/models/issue_tracker.rb +++ b/app/models/issue_tracker.rb @@ -12,7 +12,7 @@ class IssueTracker def tracker @tracker ||= begin - klass = ErrbitPlugin::Registry.issue_trackers[self.type_tracker] || ErrbitPlugin::NoneIssueTracker + klass = ErrbitPlugin::Registry.issue_trackers[type_tracker] || ErrbitPlugin::NoneIssueTracker # TODO: we need to find out a better way to pass those config to the issue tracker klass.new(options.merge( github_repo: app.try(:github_repo), @@ -22,7 +22,7 @@ class IssueTracker end def type_tracker - self.attributes['type_tracker'] ? self.attributes['type_tracker'] : 'none' + attributes['type_tracker'] ? attributes['type_tracker'] : 'none' end # Allow the tracker to validate its own params diff --git a/app/models/notification_service.rb b/app/models/notification_service.rb index 95cbbbf..78aa7a4 100644 --- a/app/models/notification_service.rb +++ b/app/models/notification_service.rb @@ -39,7 +39,7 @@ class NotificationService end # Allows us to set the issue tracker class from a single form. - def type; self._type; end + def type; _type; end def type=(t); self._type=t; end def url; nil; end diff --git a/app/models/problem.rb b/app/models/problem.rb index 2d9533c..9b4dcfc 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -233,7 +233,7 @@ class Problem end def truncate_message - self.message = self.message[0, 1000] if self.message + self.message = message[0, 1000] if message end def issue_type diff --git a/lib/configurator.rb b/lib/configurator.rb index e6451af..901f3cf 100644 --- a/lib/configurator.rb +++ b/lib/configurator.rb @@ -39,7 +39,7 @@ class Configurator # a list of environment variables to scan for configuration # @return OpenStruct configuration object def self.run(mapping) - reader = self.new(mapping) + reader = new(mapping) reader.read end -- libgit2 0.21.2