Commit fe3f623cae2f6fb459b0e8fbbdbade55f3d889ba
1 parent
7f626d1d
Exists in
master
and in
1 other branch
Rubocop: use lambda for multi-line lambdas
Showing
4 changed files
with
5 additions
and
14 deletions
Show diff stats
.rubocop_todo.yml
| ... | ... | @@ -158,15 +158,6 @@ Style/IfUnlessModifier: |
| 158 | 158 | - 'app/models/notice.rb' |
| 159 | 159 | - 'app/models/user.rb' |
| 160 | 160 | |
| 161 | -# Offense count: 6 | |
| 162 | -# Cop supports --auto-correct. | |
| 163 | -Style/Lambda: | |
| 164 | - Exclude: | |
| 165 | - - 'app/models/app.rb' | |
| 166 | - - 'app/models/problem.rb' | |
| 167 | - - 'config/load.rb' | |
| 168 | - - 'spec/models/notice_observer_spec.rb' | |
| 169 | - | |
| 170 | 161 | # Offense count: 17 |
| 171 | 162 | # Cop supports --auto-correct. |
| 172 | 163 | Style/LeadingCommentSpace: | ... | ... |
app/models/problem.rb
| ... | ... | @@ -61,7 +61,7 @@ class Problem |
| 61 | 61 | scope :resolved, -> { where(:resolved => true) } |
| 62 | 62 | scope :unresolved, -> { where(:resolved => false) } |
| 63 | 63 | scope :ordered, -> { order_by(:last_notice_at.desc) } |
| 64 | - scope :for_apps, lambda { |apps| where(:app_id.in => apps.all.map(&:id)) } | |
| 64 | + scope :for_apps, ->(apps) { where(:app_id.in => apps.all.map(&:id)) } | |
| 65 | 65 | |
| 66 | 66 | validates_presence_of :last_notice_at, :first_notice_at |
| 67 | 67 | ... | ... |
config/load.rb
| ... | ... | @@ -29,7 +29,7 @@ Errbit::Config = Configurator.run({ |
| 29 | 29 | mongo_url: %w(MONGOLAB_URI MONGOHQ_URL MONGODB_URL MONGO_URL), |
| 30 | 30 | |
| 31 | 31 | # github |
| 32 | - github_url: ['GITHUB_URL', ->(values) { | |
| 32 | + github_url: ['GITHUB_URL', lambda { |values| | |
| 33 | 33 | values[:github_url].gsub(%r{/*\z}, '') |
| 34 | 34 | }], |
| 35 | 35 | github_authentication: ['GITHUB_AUTHENTICATION'], |
| ... | ... | @@ -40,7 +40,7 @@ Errbit::Config = Configurator.run({ |
| 40 | 40 | github_api_url: ['GITHUB_API_URL'], |
| 41 | 41 | github_site_title: ['GITHUB_SITE_TITLE'], |
| 42 | 42 | |
| 43 | - email_delivery_method: ['EMAIL_DELIVERY_METHOD', -> (values) { | |
| 43 | + email_delivery_method: ['EMAIL_DELIVERY_METHOD', lambda { |values| | |
| 44 | 44 | values[:email_delivery_method] && values[:email_delivery_method].to_sym |
| 45 | 45 | }], |
| 46 | 46 | |
| ... | ... | @@ -50,7 +50,7 @@ Errbit::Config = Configurator.run({ |
| 50 | 50 | smtp_authentication: ['SMTP_AUTHENTICATION'], |
| 51 | 51 | smtp_user_name: %w(SMTP_USERNAME SENDGRID_USERNAME), |
| 52 | 52 | smtp_password: %w(SMTP_PASSWORD SENDGRID_PASSWORD), |
| 53 | - smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', ->(values) { | |
| 53 | + smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', lambda { |values| | |
| 54 | 54 | values[:smtp_domain] || |
| 55 | 55 | (values[:email_from] && values[:email_from].split('@').last) || nil |
| 56 | 56 | }], | ... | ... |