rubocop: Style/MutableConstant, 513

We didn't do this anywhere, but it's a cheap way to prevent some bugs.
This commit is contained in:
Peter Bhat Harkins 2018-03-17 19:37:50 -05:00
parent 84c1d8cf25
commit d9aefa3b3e
10 changed files with 14 additions and 14 deletions

View File

@ -1,9 +1,9 @@
class AvatarsController < ApplicationController
before_action :require_logged_in_user, :only => [:expire]
ALLOWED_SIZES = [16, 32, 100, 200]
ALLOWED_SIZES = [16, 32, 100, 200].freeze
CACHE_DIR = "#{Rails.root}/public/avatars/"
CACHE_DIR = "#{Rails.root}/public/avatars/".freeze
def expire
expired = 0

View File

@ -214,7 +214,7 @@ class HomeController < ApplicationController
end
end
TOP_INTVS = { "d" => "Day", "w" => "Week", "m" => "Month", "y" => "Year" }
TOP_INTVS = { "d" => "Day", "w" => "Week", "m" => "Month", "y" => "Year" }.freeze
def top
@cur_url = "/top"
length = { :dur => 1, :intv => "Week" }

View File

@ -57,7 +57,7 @@ class Story < ActiveRecord::Base
goo.gl is.gd ity.im j.mp lnkd.in ow.ly ph.dog po.st prettylinkpro.com q.gs
qr.ae qr.net scrnch.me s.id sptfy.com t.co tinyarrows.com tiny.cc
tinyurl.com tny.im tr.im tweez.md twitthis.com u.bb u.to v.gd vzturl.com
wp.me .ws .ws x.co yep.it yourls.org zip.net }
wp.me .ws .ws x.co yep.it yourls.org zip.net }.freeze
attr_accessor :already_posted_story, :editing_from_suggestions, :editor,
:fetching_ip, :is_hidden_by_cur_user, :is_saved_by_cur_user,

View File

@ -86,7 +86,7 @@ class User < ActiveRecord::Base
BANNED_USERNAMES = ["admin", "administrator", "contact", "fraud", "guest",
"help", "hostmaster", "inactive-user", "mailer-daemon", "moderator",
"moderators", "nobody", "postmaster", "root", "security", "support",
"sysop", "webmaster", "enable", "new", "signup",]
"sysop", "webmaster", "enable", "new", "signup",].freeze
# days old accounts are considered new for
NEW_USER_DAYS = 7

View File

@ -10,17 +10,17 @@ class Vote < ActiveRecord::Base
"T" => "Troll",
"S" => "Spam",
"" => "Cancel",
}
}.freeze
STORY_REASONS = {
"O" => "Off-topic",
"A" => "Already Posted",
"S" => "Spam",
"" => "Cancel",
}
}.freeze
OLD_STORY_REASONS = {
"Q" => "Low Quality",
}
}.freeze
def self.votes_by_user_for_stories_hash(user, stories)
votes = {}

View File

@ -43,7 +43,7 @@ end
# disable yaml/xml/whatever input parsing
silence_warnings do
ActionDispatch::ParamsParser::DEFAULT_PARSERS = {}
ActionDispatch::ParamsParser::DEFAULT_PARSERS = {}.freeze
end
# define site name and domain to be used globally, should be overridden in a

View File

@ -51,7 +51,7 @@ class Sponge
"198.18.0.0/15",
"224.0.0.0/4",
"240.0.0.0/4",
]
].freeze
# old api
def self.fetch(url, headers = {}, limit = 10)

View File

@ -4,7 +4,7 @@ class StoryCacher
# this needs to be overridden in config/initializers/production.rb
@@DIFFBOT_API_KEY = nil
DIFFBOT_API_URL = "http://www.diffbot.com/api/article"
DIFFBOT_API_URL = "http://www.diffbot.com/api/article".freeze
def self.get_story_text(story)
if !@@DIFFBOT_API_KEY

View File

@ -49,8 +49,8 @@ def story_subject(story, prefix = "")
end
EMAIL_WIDTH = 72
LAST_STORY_KEY = "mailing:last_story_id"
LAST_COMMENT_KEY = "mailing:last_comment_id"
LAST_STORY_KEY = "mailing:last_story_id".freeze
LAST_COMMENT_KEY = "mailing:last_comment_id".freeze
mailing_list_users = User.where("mailing_list_mode > 0").select {|u|
u.is_active? }

View File

@ -7,7 +7,7 @@ require File.expand_path('../../config/boot', __FILE__)
require APP_PATH
Rails.application.require_environment!
TWITTER_LIST = "users"
TWITTER_LIST = "users".freeze
# find the id of our list name
res = Twitter.oauth_request("/1.1/lists/list.json", :get)