Update rubocop
This commit is contained in:
parent
d9c1ba2315
commit
c8671c137a
21 changed files with 69 additions and 48 deletions
22
.rubocop.yml
22
.rubocop.yml
|
@ -2,6 +2,23 @@ inherit_from: .rubocop_todo.yml
|
|||
|
||||
AllCops:
|
||||
Include:
|
||||
- '**/*.gemspec'
|
||||
- '**/*.podspec'
|
||||
- '**/*.jbuilder'
|
||||
- '**/*.rake'
|
||||
- '**/*.opal'
|
||||
- '**/config.ru'
|
||||
- '**/Gemfile'
|
||||
- '**/Rakefile'
|
||||
- '**/Capfile'
|
||||
- '**/Guardfile'
|
||||
- '**/Podfile'
|
||||
- '**/Thorfile'
|
||||
- '**/Vagrantfile'
|
||||
- '**/Berksfile'
|
||||
- '**/Cheffile'
|
||||
- '**/Vagabondfile'
|
||||
- '**/Fastfile'
|
||||
- '**/*.builder'
|
||||
|
||||
Rails:
|
||||
|
@ -40,3 +57,8 @@ Style/StringLiterals:
|
|||
|
||||
Rails/HttpPositionalArguments:
|
||||
Enabled: false
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
Exclude:
|
||||
- 'db/migrate/*.rb'
|
||||
- 'app/controllers/user_controller.rb'
|
||||
|
|
36
Gemfile
36
Gemfile
|
@ -41,30 +41,30 @@ gem "autoprefixer-rails"
|
|||
gem "image_optim_rails"
|
||||
|
||||
# Load rails plugins
|
||||
gem "rails-i18n", "~> 4.0.0"
|
||||
gem "dynamic_form"
|
||||
gem "rinku", ">= 1.2.2", :require => "rails_rinku"
|
||||
gem "oauth-plugin", ">= 0.5.1"
|
||||
gem "validates_email_format_of", ">= 1.5.1"
|
||||
gem "composite_primary_keys", "~> 8.1.0"
|
||||
gem "http_accept_language", "~> 2.0.0"
|
||||
gem "paperclip", "~> 4.0"
|
||||
gem "deadlock_retry", ">= 1.2.0"
|
||||
gem "i18n-js", ">= 3.0.0.rc10"
|
||||
gem "rack-cors"
|
||||
gem "actionpack-page_caching"
|
||||
gem "composite_primary_keys", "~> 8.1.0"
|
||||
gem "deadlock_retry", ">= 1.2.0"
|
||||
gem "dynamic_form"
|
||||
gem "http_accept_language", "~> 2.0.0"
|
||||
gem "i18n-js", ">= 3.0.0.rc10"
|
||||
gem "oauth-plugin", ">= 0.5.1"
|
||||
gem "paperclip", "~> 4.0"
|
||||
gem "rack-cors"
|
||||
gem "rails-i18n", "~> 4.0.0"
|
||||
gem "rinku", ">= 1.2.2", :require => "rails_rinku"
|
||||
gem "validates_email_format_of", ">= 1.5.1"
|
||||
|
||||
# Sanitise URIs
|
||||
gem "rack-uri_sanitizer"
|
||||
|
||||
# Omniauth for authentication
|
||||
gem "omniauth"
|
||||
gem "omniauth-openid"
|
||||
gem "omniauth-google-oauth2", ">= 0.2.7"
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-windowslive"
|
||||
gem "omniauth-github"
|
||||
gem "omniauth-google-oauth2", ">= 0.2.7"
|
||||
gem "omniauth-mediawiki", ">= 0.0.3"
|
||||
gem "omniauth-openid"
|
||||
gem "omniauth-windowslive"
|
||||
|
||||
# Markdown formatting support
|
||||
gem "redcarpet"
|
||||
|
@ -73,8 +73,8 @@ gem "redcarpet"
|
|||
gem "libxml-ruby", ">= 2.0.5", :require => "libxml"
|
||||
|
||||
# Use for HTML sanitisation
|
||||
gem "sanitize"
|
||||
gem "htmlentities"
|
||||
gem "sanitize"
|
||||
|
||||
# Load SystemTimer for implementing request timeouts
|
||||
gem "SystemTimer", ">= 1.1.3", :require => "system_timer", :platforms => :ruby_18
|
||||
|
@ -102,17 +102,17 @@ end
|
|||
|
||||
# Gems needed for running tests
|
||||
group :test do
|
||||
gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
|
||||
gem "rubocop"
|
||||
gem "timecop"
|
||||
gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
|
||||
gem "webmock"
|
||||
end
|
||||
|
||||
# Needed in development as well so rake can see konacha tasks
|
||||
group :development, :test do
|
||||
gem "coveralls", :require => false
|
||||
gem "factory_girl_rails"
|
||||
gem "jshint"
|
||||
gem "konacha"
|
||||
gem "poltergeist"
|
||||
gem "factory_girl_rails"
|
||||
gem "coveralls", :require => false
|
||||
end
|
||||
|
|
|
@ -265,8 +265,8 @@ GEM
|
|||
request_store (1.3.1)
|
||||
rinku (2.0.2)
|
||||
rotp (3.3.0)
|
||||
rubocop (0.46.0)
|
||||
parser (>= 2.3.1.1, < 3.0)
|
||||
rubocop (0.47.1)
|
||||
parser (>= 2.3.3.1, < 3.0)
|
||||
powerpack (~> 0.1)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
|
@ -311,7 +311,7 @@ GEM
|
|||
thread_safe (~> 0.1)
|
||||
uglifier (3.0.4)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (1.1.2)
|
||||
unicode-display_width (1.1.3)
|
||||
validates_email_format_of (1.6.3)
|
||||
i18n
|
||||
vendorer (0.1.16)
|
||||
|
|
|
@ -220,14 +220,14 @@ class AmfController < ApplicationController
|
|||
loaded_lang = "en"
|
||||
|
||||
# Load English defaults
|
||||
en = YAML.load(File.open("#{Rails.root}/config/potlatch/locales/en.yml"))["en"]
|
||||
en = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "en.yml")))["en"]
|
||||
|
||||
if lang == "en"
|
||||
return [loaded_lang, en]
|
||||
else
|
||||
# Use English as a fallback
|
||||
begin
|
||||
other = YAML.load(File.open("#{Rails.root}/config/potlatch/locales/#{lang}.yml"))[lang]
|
||||
other = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "#{lang}.yml")))[lang]
|
||||
loaded_lang = lang
|
||||
rescue
|
||||
other = en
|
||||
|
@ -875,7 +875,7 @@ class AmfController < ApplicationController
|
|||
end
|
||||
|
||||
def getlocales
|
||||
@locales ||= Locale.list(Dir.glob("#{Rails.root}/config/potlatch/locales/*").collect { |f| File.basename(f, ".yml") })
|
||||
@locales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") })
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -39,7 +39,7 @@ class MessageController < ApplicationController
|
|||
message = Message.find(params[:message_id])
|
||||
|
||||
if message.to_user_id == @user.id
|
||||
message.update_attribute(:message_read, true)
|
||||
message.update(:message_read => true)
|
||||
|
||||
@message = Message.new(
|
||||
:recipient => message.sender,
|
||||
|
|
|
@ -5,7 +5,7 @@ class Language < ActiveRecord::Base
|
|||
|
||||
def self.load(file)
|
||||
Language.transaction do
|
||||
YAML.load(File.read(file)).each do |k, v|
|
||||
YAML.safe_load(File.read(file)).each do |k, v|
|
||||
begin
|
||||
Language.update(k, :english_name => v["english"], :native_name => v["native"])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -94,7 +94,7 @@ class User < ActiveRecord::Base
|
|||
user = nil
|
||||
end
|
||||
|
||||
token.update_column(:expiry, 1.week.from_now) if token && user
|
||||
token.update(:expiry => 1.week.from_now) if token && user
|
||||
|
||||
user
|
||||
end
|
||||
|
@ -233,7 +233,7 @@ class User < ActiveRecord::Base
|
|||
# perform a spam check on a user
|
||||
def spam_check
|
||||
if status == "active" && spam_score > SPAM_THRESHOLD
|
||||
update_column(:status, "suspended")
|
||||
update(:status => "suspended")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="mapkey">
|
||||
<table class="mapkey-table">
|
||||
<% YAML.load_file("#{Rails.root}/config/key.yml").each do |name,data| %>
|
||||
<% YAML.load_file(Rails.root.join("config", "key.yml")).each do |name,data| %>
|
||||
<% data.each do |entry| %>
|
||||
<tr class="mapkey-table-entry" data-layer="<%= name %>" data-zoom-min="<%= entry['min_zoom'] %>" data-zoom-max="<%= entry['max_zoom'] %>">
|
||||
<td class="mapkey-table-key">
|
||||
|
|
|
@ -58,6 +58,6 @@ module OpenStreetMap
|
|||
end
|
||||
|
||||
# Configure image optimisation
|
||||
config.assets.image_optim = YAML.load_file("#{Rails.root}/config/image_optim.yml")
|
||||
config.assets.image_optim = YAML.load_file(Rails.root.join("config", "image_optim.yml"))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Location of manifest file.
|
||||
Rails.application.config.assets.manifest = Rails.root.join("tmp/manifest.json")
|
||||
Rails.application.config.assets.manifest = Rails.root.join("tmp", "manifest.json")
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
Rails.application.config.assets.paths << Rails.root.join("config")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
begin
|
||||
BANNERS = YAML.load_file("#{Rails.root}/config/banners.yml").deep_symbolize_keys
|
||||
BANNERS = YAML.load_file(Rails.root.join("config", "banners.yml")).deep_symbolize_keys
|
||||
rescue
|
||||
BANNERS = {}.freeze
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ if defined?(MEMCACHE_SERVERS)
|
|||
else
|
||||
require "openid/store/filesystem"
|
||||
|
||||
openid_store = OpenID::Store::Filesystem.new(Rails.root.join("tmp/openids"))
|
||||
openid_store = OpenID::Store::Filesystem.new(Rails.root.join("tmp", "openids"))
|
||||
end
|
||||
|
||||
openid_options = { :name => "openid", :store => openid_store }
|
||||
|
|
|
@ -1 +1 @@
|
|||
WIKI_PAGES = YAML.load_file("#{Rails.root}/config/wiki_pages.yml")
|
||||
WIKI_PAGES = YAML.load_file(Rails.root.join("config", "wiki_pages.yml"))
|
||||
|
|
|
@ -216,6 +216,5 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
add_index "ways", ["id"], :name => "ways_id_version_idx"
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
def self.down; end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class CreateLanguages < ActiveRecord::Migration
|
|||
|
||||
add_primary_key :languages, [:code]
|
||||
|
||||
Language.load("#{Rails.root}/config/languages.yml")
|
||||
Language.load(Rails.root.join("config", "languages.yml"))
|
||||
|
||||
add_foreign_key :users, :languages, :column => :locale, :primary_key => :code, :name => "users_locale_fkey"
|
||||
add_foreign_key :diary_entries, :languages, :column => :language_code, :primary_key => :code, :name => "diary_entries_language_code_fkey"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DropCountries < ActiveRecord::Migration
|
||||
def change
|
||||
def up
|
||||
drop_table :countries
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class Hash
|
|||
end
|
||||
end
|
||||
|
||||
options = YAML.load(
|
||||
options = YAML.safe_load(
|
||||
ERB.new(
|
||||
IO.read(
|
||||
File.dirname(__FILE__) + "/../../config/daemons.yml"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module ID
|
||||
LOCALES = Locale.list(Rails.root.join("vendor/assets/iD/iD/locales").entries.map { |p| p.basename.to_s[/(.*).json/] && Regexp.last_match(1) }.compact)
|
||||
LOCALES = Locale.list(Rails.root.join("vendor", "assets", "iD", "iD", "locales").entries.map { |p| p.basename.to_s[/(.*).json/] && Regexp.last_match(1) }.compact)
|
||||
end
|
||||
|
|
|
@ -559,8 +559,8 @@ module OSM
|
|||
|
||||
# Return the terms and conditions text for a given country
|
||||
def self.legal_text_for_country(country_code)
|
||||
file_name = File.join(Rails.root, "config", "legales", country_code.to_s + ".yml")
|
||||
file_name = File.join(Rails.root, "config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
|
||||
file_name = Rails.root.join("config", "legales", country_code.to_s + ".yml")
|
||||
file_name = Rails.root.join("config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
|
||||
YAML.load_file(file_name)
|
||||
end
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ module Potlatch
|
|||
presettype = ""
|
||||
presetcategory = ""
|
||||
# StringIO.open(txt) do |file|
|
||||
File.open("#{Rails.root}/config/potlatch/presets.txt") do |file|
|
||||
File.open(Rails.root.join("config", "potlatch", "presets.txt")) do |file|
|
||||
file.each_line do |line|
|
||||
t = line.chomp
|
||||
if t =~ %r{(\w+)/(\w+)}
|
||||
|
@ -201,7 +201,7 @@ module Potlatch
|
|||
colours = {}
|
||||
casing = {}
|
||||
areas = {}
|
||||
File.open("#{Rails.root}/config/potlatch/colours.txt") do |file|
|
||||
File.open(Rails.root.join("config", "potlatch", "colours.txt")) do |file|
|
||||
file.each_line do |line|
|
||||
next unless line.chomp =~ /(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
|
||||
|
||||
|
@ -216,7 +216,7 @@ module Potlatch
|
|||
relcolours = {}
|
||||
relalphas = {}
|
||||
relwidths = {}
|
||||
File.open("#{Rails.root}/config/potlatch/relation_colours.txt") do |file|
|
||||
File.open(Rails.root.join("config", "potlatch", "relation_colours.txt")) do |file|
|
||||
file.each_line do |line|
|
||||
next unless line.chomp =~ /(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
|
||||
|
||||
|
@ -230,7 +230,7 @@ module Potlatch
|
|||
# Read POI presets
|
||||
icon_list = []
|
||||
icon_tags = {}
|
||||
File.open("#{Rails.root}/config/potlatch/icon_presets.txt") do |file|
|
||||
File.open(Rails.root.join("config", "potlatch", "icon_presets.txt")) do |file|
|
||||
file.each_line do |line|
|
||||
(icon, tags) = line.chomp.split("\t")
|
||||
icon_list.push(icon)
|
||||
|
@ -241,7 +241,7 @@ module Potlatch
|
|||
|
||||
# Read auto-complete
|
||||
autotags = { "point" => {}, "way" => {}, "POI" => {} }
|
||||
File.open("#{Rails.root}/config/potlatch/autocomplete.txt") do |file|
|
||||
File.open(Rails.root.join("config", "potlatch", "autocomplete.txt")) do |file|
|
||||
file.each_line do |line|
|
||||
next unless line.chomp =~ %r{^([\w:]+)/(\w+)\s+(.+)$}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ end
|
|||
exit 0 unless token == digest[0, 6]
|
||||
exit 0 if date < 1.month.ago
|
||||
|
||||
message.update_attribute(:message_read, true) if message
|
||||
message.update(:message_read => true) if message
|
||||
|
||||
mail = Mail.new(STDIN.readlines.join)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue