fix rubocop offenses for rubocop 0.40.0

This commit is contained in:
Benjamin Neff 2016-05-11 02:15:28 +02:00
parent e6f36a8fe6
commit 458265b78f
3 changed files with 33 additions and 27 deletions

View file

@ -144,7 +144,9 @@ module DiasporaFederation
# @param [Symbol] alias_name alias name # @param [Symbol] alias_name alias name
def define_alias(name, alias_name) def define_alias(name, alias_name)
class_prop_aliases[alias_name] = name class_prop_aliases[alias_name] = name
# rubocop:disable Style/Alias
instance_eval { alias_method alias_name, name } instance_eval { alias_method alias_name, name }
# rubocop:enable Style/Alias
end end
# Raised, if the name is of an unexpected type # Raised, if the name is of an unexpected type

View file

@ -37,7 +37,8 @@ describe Validation::Rule::Guid do
it "validates a long string with random characters and [-_@.:] (redmatrix)" do it "validates a long string with random characters and [-_@.:] (redmatrix)" do
validator = Validation::Validator.new( validator = Validation::Validator.new(
OpenStruct.new(guid: "1234567890ABCDefgh_ijkl-mnopqrSTUVwxyz@example.com:3000")) OpenStruct.new(guid: "1234567890ABCDefgh_ijkl-mnopqrSTUVwxyz@example.com:3000")
)
validator.rule(:guid, :guid) validator.rule(:guid, :guid)
expect(validator).to be_valid expect(validator).to be_valid

View file

@ -13,41 +13,44 @@ Logging::Rails.configure do |config|
# to the pattern layout. Color schemes should only be used with appenders # to the pattern layout. Color schemes should only be used with appenders
# that write to STDOUT or STDERR; inserting terminal color codes into a file # that write to STDOUT or STDERR; inserting terminal color codes into a file
# is generally considered bad form. # is generally considered bad form.
Logging.color_scheme("bright", Logging.color_scheme(
levels: { "bright",
info: :green, levels: {
warn: :yellow, info: :green,
error: :red, warn: :yellow,
fatal: %i(white on_red) error: :red,
}, fatal: %i(white on_red)
date: :blue, },
logger: :cyan, date: :blue,
message: :magenta logger: :cyan,
) message: :magenta
)
# Configure an appender that will write log events to STDOUT. A colorized # Configure an appender that will write log events to STDOUT. A colorized
# pattern layout is used to format the log events into strings before # pattern layout is used to format the log events into strings before
# writing. # writing.
Logging.appenders.stdout("stdout", Logging.appenders.stdout(
auto_flushing: true, "stdout",
layout: Logging.layouts.pattern( auto_flushing: true,
pattern: pattern, layout: Logging.layouts.pattern(
color_scheme: "bright" pattern: pattern,
) color_scheme: "bright"
) if config.log_to.include? "stdout" )
) if config.log_to.include? "stdout"
# Configure an appender that will write log events to a file. The file will # Configure an appender that will write log events to a file. The file will
# be rolled on a daily basis, and the past 7 rolled files will be kept. # be rolled on a daily basis, and the past 7 rolled files will be kept.
# Older files will be deleted. The default pattern layout is used when # Older files will be deleted. The default pattern layout is used when
# formatting log events into strings. # formatting log events into strings.
Logging.appenders.rolling_file("file", Logging.appenders.rolling_file(
filename: config.paths["log"].first, "file",
keep: 7, filename: config.paths["log"].first,
age: "daily", keep: 7,
truncate: false, age: "daily",
auto_flushing: true, truncate: false,
layout: layout auto_flushing: true,
) if config.log_to.include? "file" layout: layout
) if config.log_to.include? "file"
# Setup the root logger with the Rails log level and the desired set of # Setup the root logger with the Rails log level and the desired set of
# appenders. The list of appenders to use should be set in the environment # appenders. The list of appenders to use should be set in the environment