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