Commit d272b2e2a2b4d5fc9341013b31e524bb986811df

Authored by Laust Rud Jacobsen
1 parent 5424a5c8
Exists in master and in 1 other branch production

Rubocop: remove redundant self. calls

.rubocop_todo.yml
... ... @@ -13,7 +13,7 @@ Metrics/AbcSize:
13 13 # Offense count: 5
14 14 # Configuration parameters: CountComments.
15 15 Metrics/ClassLength:
16   - Max: 205
  16 + Max: 206
17 17  
18 18 # Offense count: 5
19 19 Metrics/CyclomaticComplexity:
... ... @@ -363,16 +363,6 @@ Style/Proc:
363 363 Style/RaiseArgs:
364 364 Enabled: false
365 365  
366   -# Offense count: 13
367   -# Cop supports --auto-correct.
368   -Style/RedundantSelf:
369   - Exclude:
370   - - 'app/models/app.rb'
371   - - 'app/models/issue_tracker.rb'
372   - - 'app/models/notification_service.rb'
373   - - 'app/models/problem.rb'
374   - - 'lib/configurator.rb'
375   -
376 366 # Offense count: 3
377 367 # Cop supports --auto-correct.
378 368 # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
... ...
app/models/app.rb
... ... @@ -106,11 +106,11 @@ class App
106 106 alias_method :notify_on_deploys?, :notify_on_deploys
107 107  
108 108 def repo_branch
109   - self.repository_branch.present? ? self.repository_branch : 'master'
  109 + repository_branch.present? ? repository_branch : 'master'
110 110 end
111 111  
112 112 def github_repo?
113   - self.github_repo.present?
  113 + github_repo.present?
114 114 end
115 115  
116 116 def github_url
... ... @@ -122,7 +122,7 @@ class App
122 122 end
123 123  
124 124 def bitbucket_repo?
125   - self.bitbucket_repo.present?
  125 + bitbucket_repo.present?
126 126 end
127 127  
128 128 def bitbucket_url
... ... @@ -157,12 +157,12 @@ class App
157 157 if (copy_app = App.where(:_id => app_id).first)
158 158 # Copy fields
159 159 (copy_app.fields.keys - %w(_id name created_at updated_at)).each do |k|
160   - self.send("#{k}=", copy_app.send(k))
  160 + send("#{k}=", copy_app.send(k))
161 161 end
162 162 # Clone the embedded objects that can be changed via apps/edit (ignore errs & deploys, etc.)
163 163 %w(watchers issue_tracker notification_service).each do |relation|
164 164 if (obj = copy_app.send(relation))
165   - self.send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone)
  165 + send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone)
166 166 end
167 167 end
168 168 end
... ...
app/models/issue_tracker.rb
... ... @@ -12,7 +12,7 @@ class IssueTracker
12 12 def tracker
13 13 @tracker ||=
14 14 begin
15   - klass = ErrbitPlugin::Registry.issue_trackers[self.type_tracker] || ErrbitPlugin::NoneIssueTracker
  15 + klass = ErrbitPlugin::Registry.issue_trackers[type_tracker] || ErrbitPlugin::NoneIssueTracker
16 16 # TODO: we need to find out a better way to pass those config to the issue tracker
17 17 klass.new(options.merge(
18 18 github_repo: app.try(:github_repo),
... ... @@ -22,7 +22,7 @@ class IssueTracker
22 22 end
23 23  
24 24 def type_tracker
25   - self.attributes['type_tracker'] ? self.attributes['type_tracker'] : 'none'
  25 + attributes['type_tracker'] ? attributes['type_tracker'] : 'none'
26 26 end
27 27  
28 28 # Allow the tracker to validate its own params
... ...
app/models/notification_service.rb
... ... @@ -39,7 +39,7 @@ class NotificationService
39 39 end
40 40  
41 41 # Allows us to set the issue tracker class from a single form.
42   - def type; self._type; end
  42 + def type; _type; end
43 43 def type=(t); self._type=t; end
44 44  
45 45 def url; nil; end
... ...
app/models/problem.rb
... ... @@ -233,7 +233,7 @@ class Problem
233 233 end
234 234  
235 235 def truncate_message
236   - self.message = self.message[0, 1000] if self.message
  236 + self.message = message[0, 1000] if message
237 237 end
238 238  
239 239 def issue_type
... ...
lib/configurator.rb
... ... @@ -39,7 +39,7 @@ class Configurator
39 39 # a list of environment variables to scan for configuration
40 40 # @return OpenStruct configuration object
41 41 def self.run(mapping)
42   - reader = self.new(mapping)
  42 + reader = new(mapping)
43 43 reader.read
44 44 end
45 45  
... ...