Routine rubocop fixes (#10478)
This commit is contained in:
parent
f7d781258b
commit
fe75dcde1c
9 changed files with 21 additions and 21 deletions
|
|
@ -1,13 +1,13 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
|
||||
# using RuboCop version 0.92.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# https://github.com/openstreetmap/openstreetmap-website/issues/2472
|
||||
require:
|
||||
- rubocop-performance
|
||||
- rubocop-rails
|
||||
- rubocop-rspec
|
||||
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2020-09-07 10:28:36 UTC using RuboCop version 0.90.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ concern :ActsAsProfileField do
|
|||
included do
|
||||
before_create :generate_attribute_name
|
||||
|
||||
WORD_REGEX = /\w+/.freeze
|
||||
WORD_REGEX = /\w+/.freeze # rubocop:disable Lint/ConstantDefinitionInBlock
|
||||
|
||||
validates :label, presence: true, uniqueness: { case_sensitive: false }
|
||||
validates :attribute_name, presence: true, on: :update
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ module Github
|
|||
end
|
||||
|
||||
# adapted from https://api.rubyonrails.org/classes/Module.html#method-i-delegate_missing_to
|
||||
def respond_to_missing?(method, _include_all = false) # rubocop:disable Style/OptionalBooleanParameter
|
||||
def respond_to_missing?(method, _include_all = false)
|
||||
target.respond_to?(method, false) || super
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ module Search
|
|||
end
|
||||
|
||||
# adapted from https://api.rubyonrails.org/classes/Module.html#method-i-delegate_missing_to
|
||||
def respond_to_missing?(method, _include_all = false) # rubocop:disable Style/OptionalBooleanParameter
|
||||
def respond_to_missing?(method, _include_all = false)
|
||||
target.respond_to?(method, false) || super
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module TwitterClient
|
|||
end
|
||||
|
||||
# adapted from https://api.rubyonrails.org/classes/Module.html#method-i-delegate_missing_to
|
||||
def respond_to_missing?(method, _include_all = false) # rubocop:disable Style/OptionalBooleanParameter
|
||||
def respond_to_missing?(method, _include_all = false)
|
||||
target.respond_to?(method, false) || super
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ module Metrics
|
|||
models = [User, Article, Organization, Comment, Podcast, PodcastEpisode, Listing, PageView, Notification]
|
||||
models.each do |model|
|
||||
db_count = begin
|
||||
model.count
|
||||
rescue ActiveRecord::QueryCanceled
|
||||
model.estimated_count
|
||||
end
|
||||
model.count
|
||||
rescue ActiveRecord::QueryCanceled
|
||||
model.estimated_count
|
||||
end
|
||||
|
||||
Rails.logger.info(message: "db_table_size", table_info: { table_name: model.table_name, table_size: db_count })
|
||||
DatadogStatsClient.gauge("postgres.db_table_size", db_count, tags: ["table_name:#{model.table_name}"])
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ Rails.application.configure do
|
|||
# DEV uses the RedisCloud Heroku Add-On which comes with the predefined env variable REDISCLOUD_URL
|
||||
redis_url = ENV["REDISCLOUD_URL"]
|
||||
redis_url ||= ENV["REDIS_URL"]
|
||||
DEFAULT_EXPIRATION = 24.hours.to_i.freeze
|
||||
config.cache_store = :redis_cache_store, { url: redis_url, expires_in: DEFAULT_EXPIRATION }
|
||||
default_expiration = 24.hours.to_i
|
||||
config.cache_store = :redis_cache_store, { url: redis_url, expires_in: default_expiration }
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# config.active_job.queue_adapter = :resque
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ RSpec.describe GithubTag::GithubReadmeTag, type: :liquid_tag, vcr: true do
|
|||
end
|
||||
|
||||
it "renders a repository with a missing README" do
|
||||
allow_any_instance_of(Github::OauthClient).to receive(:readme).and_raise(Github::Errors::NotFound)
|
||||
allow_any_instance_of(Github::OauthClient).to receive(:readme).and_raise(Github::Errors::NotFound) # rubocop:disable RSpec/AnyInstance
|
||||
|
||||
VCR.use_cassette("github_client_repository") do
|
||||
template = generate_tag(url_repository).render
|
||||
|
|
|
|||
|
|
@ -129,9 +129,9 @@ RSpec.describe "Api::V0::Webhooks", type: :request do
|
|||
"github_username" => webhook.user.github_username,
|
||||
"website_url" => webhook.user.processed_website_url,
|
||||
"profile_image" => Images::Profile.call(webhook.user.profile_image_url,
|
||||
length: 640),
|
||||
length: 640),
|
||||
"profile_image_90" => Images::Profile.call(webhook.user.profile_image_url,
|
||||
length: 90)
|
||||
length: 90)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue