DEV: Enable Style/SingleLineMethods and Style/Semicolon in Rubocop (#6717)

This commit is contained in:
David Taylor
2018-12-04 03:48:13 +00:00
committed by Guo Xiang Tan
parent 56948896ff
commit 9248ad1905
30 changed files with 171 additions and 72 deletions

View File

@@ -5,8 +5,12 @@ module Autospec
class QunitRunner < BaseRunner
WATCHERS = {}
def self.watch(pattern, &blk); WATCHERS[pattern] = blk; end
def watchers; WATCHERS; end
def self.watch(pattern, &blk)
WATCHERS[pattern] = blk
end
def watchers
WATCHERS
end
# Discourse specific
watch(%r{^app/assets/javascripts/discourse/(.+)\.js.es6$}) { |m| "test/javascripts/#{m[1]}-test.js.es6" }
@@ -14,8 +18,12 @@ module Autospec
watch(%r{^test/javascripts/.+\.js.es6$})
RELOADERS = Set.new
def self.reload(pattern); RELOADERS << pattern; end
def reloaders; RELOADERS; end
def self.reload(pattern)
RELOADERS << pattern
end
def reloaders
RELOADERS
end
# Discourse specific
reload(%r{^test/javascripts/fixtures/.+_fixtures\.js(\.es6)?$})

View File

@@ -3,8 +3,12 @@ module Autospec
class RspecRunner < BaseRunner
WATCHERS = {}
def self.watch(pattern, &blk); WATCHERS[pattern] = blk; end
def watchers; WATCHERS; end
def self.watch(pattern, &blk)
WATCHERS[pattern] = blk
end
def watchers
WATCHERS
end
# Discourse specific
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/components/#{m[1]}_spec.rb" }
@@ -30,8 +34,12 @@ module Autospec
watch(%r{^(plugins/.*)/lib/(.*)\.rb}) { |m| "#{m[1]}/spec/lib/#{m[2]}_spec.rb" }
RELOADERS = Set.new
def self.reload(pattern); RELOADERS << pattern; end
def reloaders; RELOADERS; end
def self.reload(pattern)
RELOADERS << pattern
end
def reloaders
RELOADERS
end
# we are using a simple runner at the moment, whole idea of using a reloader is no longer needed
watch("spec/rails_helper.rb")

View File

@@ -28,7 +28,7 @@ module Tilt
ctx = MiniRacer::Context.new(timeout: 15000)
ctx.eval("var self = this; #{File.read("#{Rails.root}/vendor/assets/javascripts/babel.js")}")
ctx.eval(File.read(Ember::Source.bundled_path_for('ember-template-compiler.js')))
ctx.eval("module = {}; exports = {};");
ctx.eval("module = {}; exports = {};")
ctx.attach("rails.logger.info", proc { |err| Rails.logger.info(err.to_s) })
ctx.attach("rails.logger.error", proc { |err| Rails.logger.error(err.to_s) })
ctx.eval <<JS

View File

@@ -19,17 +19,39 @@ class Guardian
include TagGuardian
class AnonymousUser
def blank?; true; end
def admin?; false; end
def staff?; false; end
def moderator?; false; end
def approved?; false; end
def staged?; false; end
def silenced?; false; end
def secure_category_ids; []; end
def topic_create_allowed_category_ids; []; end
def has_trust_level?(level); false; end
def email; nil; end
def blank?
true
end
def admin?
false
end
def staff?
false
end
def moderator?
false
end
def approved?
false
end
def staged?
false
end
def silenced?
false
end
def secure_category_ids
[]
end
def topic_create_allowed_category_ids
[]
end
def has_trust_level?(level)
false
end
def email
nil
end
end
attr_accessor :can_see_emails

View File

@@ -3,7 +3,9 @@ require "nokogiri"
class HtmlToMarkdown
class Block < Struct.new(:name, :head, :body, :opened, :markdown)
def initialize(name, head = "", body = "", opened = false, markdown = ""); super; end
def initialize(name, head = "", body = "", opened = false, markdown = "")
super
end
end
def initialize(html, opts = {})

View File

@@ -50,7 +50,9 @@ class Migration::SafeMigrate
super
rescue => e
if e.cause.is_a?(Discourse::InvalidMigration)
def e.cause; nil; end
def e.cause
nil
end
def e.backtrace
super.reject do |frame|
frame =~ /safe_migrate\.rb/ || frame =~ /schema_migration_details\.rb/

View File

@@ -32,7 +32,7 @@ module Stylesheet
end
def self.compile(stylesheet, filename, options = {})
source_map_file = options[:source_map_file] || "#{filename.sub(".scss", "")}.css.map";
source_map_file = options[:source_map_file] || "#{filename.sub(".scss", "")}.css.map"
engine = SassC::Engine.new(stylesheet,
importer: Importer,

View File

@@ -12,7 +12,7 @@ class AllowUserLocaleEnabledValidator
end
def error_message
I18n.t("site_settings.errors.user_locale_not_enabled");
I18n.t("site_settings.errors.user_locale_not_enabled")
end
end