diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 18f0488..7dac329 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -158,15 +158,6 @@ Style/IfUnlessModifier: - 'app/models/notice.rb' - 'app/models/user.rb' -# Offense count: 6 -# Cop supports --auto-correct. -Style/Lambda: - Exclude: - - 'app/models/app.rb' - - 'app/models/problem.rb' - - 'config/load.rb' - - 'spec/models/notice_observer_spec.rb' - # Offense count: 17 # Cop supports --auto-correct. Style/LeadingCommentSpace: diff --git a/app/models/problem.rb b/app/models/problem.rb index 998b711..c7c5ef2 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -61,7 +61,7 @@ class Problem scope :resolved, -> { where(:resolved => true) } scope :unresolved, -> { where(:resolved => false) } scope :ordered, -> { order_by(:last_notice_at.desc) } - scope :for_apps, lambda { |apps| where(:app_id.in => apps.all.map(&:id)) } + scope :for_apps, ->(apps) { where(:app_id.in => apps.all.map(&:id)) } validates_presence_of :last_notice_at, :first_notice_at diff --git a/config/load.rb b/config/load.rb index 3f6fb7e..d315f39 100644 --- a/config/load.rb +++ b/config/load.rb @@ -29,7 +29,7 @@ Errbit::Config = Configurator.run({ mongo_url: %w(MONGOLAB_URI MONGOHQ_URL MONGODB_URL MONGO_URL), # github - github_url: ['GITHUB_URL', ->(values) { + github_url: ['GITHUB_URL', lambda { |values| values[:github_url].gsub(%r{/*\z}, '') }], github_authentication: ['GITHUB_AUTHENTICATION'], @@ -40,7 +40,7 @@ Errbit::Config = Configurator.run({ github_api_url: ['GITHUB_API_URL'], github_site_title: ['GITHUB_SITE_TITLE'], - email_delivery_method: ['EMAIL_DELIVERY_METHOD', -> (values) { + email_delivery_method: ['EMAIL_DELIVERY_METHOD', lambda { |values| values[:email_delivery_method] && values[:email_delivery_method].to_sym }], @@ -50,7 +50,7 @@ Errbit::Config = Configurator.run({ smtp_authentication: ['SMTP_AUTHENTICATION'], smtp_user_name: %w(SMTP_USERNAME SENDGRID_USERNAME), smtp_password: %w(SMTP_PASSWORD SENDGRID_PASSWORD), - smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', ->(values) { + smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', lambda { |values| values[:smtp_domain] || (values[:email_from] && values[:email_from].split('@').last) || nil }], diff --git a/spec/models/notice_observer_spec.rb b/spec/models/notice_observer_spec.rb index 25a3b9a..ec16164 100644 --- a/spec/models/notice_observer_spec.rb +++ b/spec/models/notice_observer_spec.rb @@ -1,6 +1,6 @@ describe "Callback on Notice", type: 'model' do let(:notice_attrs_for) do - ->(api_key) do + lambda do |api_key| { error_class: "HoptoadTestingException", message: "some message", -- libgit2 0.21.2