Commit 4ef0033953e943dc803d2f243f48cd1094fbe1b0
1 parent
c189653b
Exists in
master
and in
1 other branch
Rubocop: just use the simple symbol proc invocation mechanism
Showing
4 changed files
with
3 additions
and
12 deletions
Show diff stats
.rubocop_todo.yml
| @@ -275,12 +275,3 @@ Style/SingleSpaceBeforeFirstArg: | @@ -275,12 +275,3 @@ Style/SingleSpaceBeforeFirstArg: | ||
| 275 | # Configuration parameters: EnforcedStyle, SupportedStyles. | 275 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
| 276 | Style/StringLiterals: | 276 | Style/StringLiterals: |
| 277 | Enabled: false | 277 | Enabled: false |
| 278 | - | ||
| 279 | -# Offense count: 3 | ||
| 280 | -# Cop supports --auto-correct. | ||
| 281 | -# Configuration parameters: IgnoredMethods. | ||
| 282 | -Style/SymbolProc: | ||
| 283 | - Exclude: | ||
| 284 | - - 'app/controllers/users/omniauth_callbacks_controller.rb' | ||
| 285 | - - 'app/models/deploy.rb' | ||
| 286 | - - 'spec/models/deploy_spec.rb' |
app/controllers/users/omniauth_callbacks_controller.rb
| @@ -10,7 +10,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | @@ -10,7 +10,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | ||
| 10 | # If they are, automatically create an account | 10 | # If they are, automatically create an account |
| 11 | client = Octokit::Client.new(access_token: github_token) | 11 | client = Octokit::Client.new(access_token: github_token) |
| 12 | client.api_endpoint = Errbit::Config.github_api_url | 12 | client.api_endpoint = Errbit::Config.github_api_url |
| 13 | - org_ids = client.organizations.map { |org| org.id } | 13 | + org_ids = client.organizations.map(&:id) |
| 14 | if org_ids.include?(github_org_id) | 14 | if org_ids.include?(github_org_id) |
| 15 | github_user = User.create(name: env["omniauth.auth"].extra.raw_info.name, email: env["omniauth.auth"].extra.raw_info.email) | 15 | github_user = User.create(name: env["omniauth.auth"].extra.raw_info.name, email: env["omniauth.auth"].extra.raw_info.email) |
| 16 | end | 16 | end |
app/models/deploy.rb
| @@ -19,7 +19,7 @@ class Deploy | @@ -19,7 +19,7 @@ class Deploy | ||
| 19 | validates_presence_of :username, :environment | 19 | validates_presence_of :username, :environment |
| 20 | 20 | ||
| 21 | def resolve_app_errs | 21 | def resolve_app_errs |
| 22 | - app.problems.unresolved.in_env(environment).each { |problem| problem.resolve! } | 22 | + app.problems.unresolved.in_env(environment).each(&:resolve!) |
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | def short_revision | 25 | def short_revision |
spec/models/deploy_spec.rb
| @@ -19,7 +19,7 @@ describe Deploy, type: 'model' do | @@ -19,7 +19,7 @@ describe Deploy, type: 'model' do | ||
| 19 | app = Fabricate(:app, :resolve_errs_on_deploy => false) | 19 | app = Fabricate(:app, :resolve_errs_on_deploy => false) |
| 20 | @problems = 3.times.map { Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app)) } | 20 | @problems = 3.times.map { Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app)) } |
| 21 | Fabricate(:deploy, :app => app) | 21 | Fabricate(:deploy, :app => app) |
| 22 | - expect(app.reload.problems.none? { |problem| problem.resolved? }).to eq true | 22 | + expect(app.reload.problems.none?(&:resolved?)).to eq true |
| 23 | end | 23 | end |
| 24 | end | 24 | end |
| 25 | 25 |