Make Rubocop happy again (#14729)
This commit is contained in:
parent
c8dd728210
commit
a32b50d46c
6 changed files with 24 additions and 6 deletions
|
|
@ -671,6 +671,9 @@ Style/SwapValues:
|
|||
Style/TopLevelMethodDefinition:
|
||||
Description: 'This cop looks for top-level method definitions.'
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- scripts/release
|
||||
- scripts/stage_release
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
Description: 'Checks for trailing comma in argument lists.'
|
||||
|
|
@ -785,6 +788,11 @@ Rails/AddColumnIndex:
|
|||
index might be used.
|
||||
Enabled: true
|
||||
|
||||
Rails/Date:
|
||||
Exclude:
|
||||
- scripts/release
|
||||
- scripts/stage_release
|
||||
|
||||
Rails/DefaultScope:
|
||||
Description: 'Avoid use of `default_scope`.'
|
||||
StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
|
||||
|
|
|
|||
|
|
@ -1,13 +1,23 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
|
||||
# using RuboCop version 0.93.0.
|
||||
# using RuboCop version 1.21.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
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
Exclude:
|
||||
- 'app/models/article.rb'
|
||||
- 'app/models/chat_channel.rb'
|
||||
- 'app/models/organization.rb'
|
||||
- 'app/models/user.rb'
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class BlackBox
|
|||
|
||||
def last_mile_hotness_calc(article)
|
||||
score_from_epoch = article.featured_number.to_i - OUR_EPOCH_NUMBER # Approximate time of publish - epoch time
|
||||
score_from_epoch / 1000 +
|
||||
(score_from_epoch / 1000) +
|
||||
([article.score, 650].min * 2) +
|
||||
([article.comment_score, 650].min * 2) -
|
||||
(article.spaminess_rating * 5)
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def handle_organization_tab
|
||||
@organizations = @current_user.organizations.order(name: :asc)
|
||||
if params[:org_id] == "new" || params[:org_id].blank? && @organizations.size.zero?
|
||||
if params[:org_id] == "new" || (params[:org_id].blank? && @organizations.size.zero?)
|
||||
@organization = Organization.new
|
||||
elsif params[:org_id].blank? || params[:org_id].match?(/\d/)
|
||||
@organization = Organization.find_by(id: params[:org_id]) || @organizations.first
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ class Article < ApplicationRecord
|
|||
|
||||
def search_score
|
||||
comments_score = (comments_count * 3).to_i
|
||||
partial_score = (comments_score + public_reactions_count.to_i * 300 * user.reputation_modifier * score.to_i)
|
||||
partial_score = (comments_score + (public_reactions_count.to_i * 300 * user.reputation_modifier * score.to_i))
|
||||
calculated_score = hotness_score.to_i + partial_score
|
||||
calculated_score.to_i
|
||||
end
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
"bundle exec rubocop --require rubocop-rspec --auto-correct"
|
||||
],
|
||||
"scripts/{release,stage_release}": [
|
||||
"bundle exec rubocop --require rubocop-rspec --auto-correct --except Style/TopLevelMethodDefinition,Rails/Date"
|
||||
"bundle exec rubocop --require rubocop-rspec --auto-correct"
|
||||
],
|
||||
"app/views/**/*.jbuilder": [
|
||||
"bundle exec rubocop --require rubocop-rspec --auto-correct"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue