Bump rubocop from 0.93.1 to 1.0.0 (#2391)
* Bump rubocop from 0.93.1 to 1.0.0 Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.93.1 to 1.0.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.93.1...v1.0.0) Signed-off-by: dependabot[bot] <support@github.com> * Rubocop 1.0 part 1 * 1.0.1 * 1.0.2 * 1.0.3 * 1.0.4 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Thomas Reynolds <me@tdreyno.com>
This commit is contained in:
parent
4e0a8ec77c
commit
c617c2c165
12
.rubocop.yml
12
.rubocop.yml
|
@ -66,6 +66,8 @@ Style/MissingRespondToMissing:
|
|||
Enabled: false
|
||||
Lint/MissingSuper:
|
||||
Enabled: false
|
||||
Lint/EmptyFile:
|
||||
Enabled: false
|
||||
Style/EvalWithLocation:
|
||||
Enabled: false
|
||||
Style/ClassVars:
|
||||
|
@ -74,3 +76,13 @@ Style/GlobalVars:
|
|||
Enabled: false
|
||||
Style/Proc:
|
||||
Enabled: false
|
||||
Style/OptionalBooleanParameter:
|
||||
Enabled: false
|
||||
Style/AccessorGrouping:
|
||||
Enabled: false
|
||||
Style/RedundantRegexpEscape:
|
||||
Enabled: false
|
||||
Style/StringConcatenation:
|
||||
Enabled: false
|
||||
Style/RedundantSelfAssignment:
|
||||
Enabled: false
|
2
Gemfile
2
Gemfile
|
@ -37,7 +37,7 @@ gem 'mini_racer', '~> 0.3.1', platforms: :ruby
|
|||
gem 'therubyrhino', '>= 2.0', platforms: :jruby
|
||||
|
||||
# Code Quality
|
||||
gem 'rubocop', '~> 0.93', require: false
|
||||
gem 'rubocop', '~> 1.0', require: false
|
||||
gem 'rubocop-performance', '~> 1.8', require: false
|
||||
gem 'simplecov', '~> 0.19', require: false
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.3)
|
||||
rubocop (0.93.1)
|
||||
rubocop (1.0.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.1.5)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
|
@ -211,7 +211,7 @@ GEM
|
|||
rubocop-ast (>= 0.6.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-ast (0.7.1)
|
||||
rubocop-ast (1.0.0)
|
||||
parser (>= 2.7.1.5)
|
||||
rubocop-performance (1.8.1)
|
||||
rubocop (>= 0.87.0)
|
||||
|
@ -275,7 +275,7 @@ DEPENDENCIES
|
|||
rake (~> 13.0)
|
||||
redcarpet (>= 3.1)
|
||||
rspec (~> 3.0)
|
||||
rubocop (~> 0.93)
|
||||
rubocop (~> 1.0)
|
||||
rubocop-performance (~> 1.8)
|
||||
rubydns (~> 2.0.2)
|
||||
sassc (~> 2.4)
|
||||
|
|
|
@ -20,11 +20,12 @@ module Middleman::Cli
|
|||
|
||||
def self.import_config(base)
|
||||
::Middleman::Cli.config.all_settings.each do |setting|
|
||||
if setting.default.is_a?(String) || setting.default.is_a?(NilClass)
|
||||
case setting.default
|
||||
when String, NilClass
|
||||
base.class_option setting.key,
|
||||
type: :string,
|
||||
desc: setting.description
|
||||
elsif setting.default.is_a?(TrueClass) || setting.default.is_a?(FalseClass)
|
||||
when TrueClass, FalseClass
|
||||
base.class_option setting.key,
|
||||
type: :boolean,
|
||||
desc: setting.description
|
||||
|
|
|
@ -14,7 +14,7 @@ require 'middleman-core/template_renderer'
|
|||
|
||||
# Core Middleman Class
|
||||
module Middleman
|
||||
MiddlewareDescriptor = Struct.new(:class, :options, :block)
|
||||
MiddlewareDescriptor = Struct.new(:klass, :options, :block)
|
||||
MapDescriptor = Struct.new(:path, :block)
|
||||
|
||||
class Application
|
||||
|
|
|
@ -73,9 +73,10 @@ module Middleman
|
|||
|
||||
return data unless @track_data_access
|
||||
|
||||
if data.is_a? ::Middleman::Util::EnhancedHash
|
||||
case data
|
||||
when ::Middleman::Util::EnhancedHash
|
||||
Data::Proxies::HashProxy.new(k, data, @data_collection_depth, parent)
|
||||
elsif data.is_a? ::Array
|
||||
when ::Array
|
||||
Data::Proxies::ArrayProxy.new(k, data, @data_collection_depth, parent)
|
||||
else
|
||||
raise 'Invalid data to wrap'
|
||||
|
|
|
@ -33,13 +33,14 @@ module Middleman
|
|||
end
|
||||
|
||||
def take_ownership_of_value(v)
|
||||
if v.is_a?(::Array)
|
||||
case v
|
||||
when ::Array
|
||||
take_ownership_of_array(v)
|
||||
elsif v.is_a?(::Hash)
|
||||
when ::Hash
|
||||
take_ownership_of_hash(v)
|
||||
elsif v.is_a?(::Middleman::CoreExtensions::Data::Proxies::ArrayProxy)
|
||||
when ::Middleman::CoreExtensions::Data::Proxies::ArrayProxy
|
||||
v.clone.tap { |p| p._top._replace_parent(self) }
|
||||
elsif v.is_a?(::Middleman::CoreExtensions::Data::Proxies::HashProxy)
|
||||
when ::Middleman::CoreExtensions::Data::Proxies::HashProxy
|
||||
v.clone.tap { |p| p._top._replace_parent(self) }
|
||||
else
|
||||
v
|
||||
|
|
|
@ -122,7 +122,7 @@ module Middleman
|
|||
end
|
||||
|
||||
graph = Graph.new
|
||||
vertices.values.each { |v| graph.add_vertex(v) }
|
||||
vertices.each_value { |v| graph.add_vertex(v) }
|
||||
|
||||
data['edges'].each do |k, deps|
|
||||
deps.each do |d|
|
||||
|
|
|
@ -209,7 +209,7 @@ module Middleman
|
|||
def expose_to_application(*symbols)
|
||||
self.exposed_to_application ||= {}
|
||||
|
||||
if symbols.first&.is_a?(Hash)
|
||||
if symbols.first.is_a?(Hash)
|
||||
self.exposed_to_application.merge!(symbols.first)
|
||||
elsif symbols.is_a? Array
|
||||
symbols.each do |sym|
|
||||
|
@ -229,7 +229,7 @@ module Middleman
|
|||
def expose_to_config(*symbols)
|
||||
self.exposed_to_config ||= {}
|
||||
|
||||
if symbols.first&.is_a?(Hash)
|
||||
if symbols.first.is_a?(Hash)
|
||||
self.exposed_to_config.merge!(symbols.first)
|
||||
elsif symbols.is_a? Array
|
||||
symbols.each do |sym|
|
||||
|
@ -249,7 +249,7 @@ module Middleman
|
|||
def expose_to_template(*symbols)
|
||||
self.exposed_to_template ||= {}
|
||||
|
||||
if symbols.first&.is_a?(Hash)
|
||||
if symbols.first.is_a?(Hash)
|
||||
self.exposed_to_template.merge!(symbols.first)
|
||||
elsif symbols.is_a? Array
|
||||
symbols.each do |sym|
|
||||
|
@ -421,9 +421,10 @@ module Middleman
|
|||
|
||||
def generate_resources(resources)
|
||||
generator_defs = self.class.resources_generators.reduce({}) do |sum, g|
|
||||
resource_definitions = if g.is_a? Hash
|
||||
resource_definitions = case g
|
||||
when Hash
|
||||
g
|
||||
elsif g.is_a? Symbol
|
||||
when Symbol
|
||||
definition = method(g)
|
||||
|
||||
if definition.arity.zero?
|
||||
|
@ -475,9 +476,10 @@ module Middleman
|
|||
return unless ext.respond_to?(:after_build)
|
||||
|
||||
@app.after_build do |builder|
|
||||
if ext.method(:after_build).arity == 1
|
||||
case ext.method(:after_build).arity
|
||||
when 1
|
||||
ext.after_build(builder)
|
||||
elsif ext.method(:after_build).arity == 2
|
||||
when 2
|
||||
ext.after_build(builder, builder.thor)
|
||||
else
|
||||
ext.after_build
|
||||
|
|
|
@ -43,9 +43,10 @@ class Middleman::Extensions::AssetHost < ::Middleman::Extension
|
|||
asset_path
|
||||
end
|
||||
|
||||
asset_prefix = if options[:host].is_a?(Proc)
|
||||
asset_prefix = case options[:host]
|
||||
when Proc
|
||||
options[:host].call(full_asset_path)
|
||||
elsif options[:host].is_a?(String)
|
||||
when String
|
||||
options[:host]
|
||||
end
|
||||
|
||||
|
|
|
@ -83,9 +83,8 @@ class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
|
|||
end
|
||||
|
||||
current_dir = Pathname(request_path).dirname
|
||||
result = Pathname(full_asset_path).relative_path_from(current_dir).to_s
|
||||
|
||||
result
|
||||
Pathname(full_asset_path).relative_path_from(current_dir).to_s
|
||||
end
|
||||
memoize :rewrite_url
|
||||
end
|
||||
|
|
|
@ -309,7 +309,7 @@ module Middleman
|
|||
cert.add_extension(aki)
|
||||
cert.add_extension ef.create_extension('subjectAltName', aliases.map { |d| "DNS: #{d}" }.join(','))
|
||||
|
||||
cert.sign(rsa, OpenSSL::Digest::SHA1.new)
|
||||
cert.sign(rsa, OpenSSL::Digest.new('SHA1'))
|
||||
|
||||
[cert, rsa]
|
||||
end
|
||||
|
|
|
@ -5,6 +5,7 @@ module Middleman
|
|||
class << self
|
||||
# The profiler instance. There can only be one!
|
||||
attr_writer :profiler
|
||||
|
||||
def profiler
|
||||
@profiler ||= NullProfiler.new
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ module Middleman
|
|||
app.use ::Rack::Head
|
||||
|
||||
@middleman.middleware.each do |middleware|
|
||||
app.use(middleware[:class], *middleware[:options], &middleware[:block])
|
||||
app.use(middleware[:klass], *middleware[:options], &middleware[:block])
|
||||
end
|
||||
|
||||
inner_app = self
|
||||
|
|
|
@ -35,9 +35,7 @@ module Middleman
|
|||
options[:save_buffer] = true
|
||||
end
|
||||
@engine = ::Haml::Engine.new(data, options)
|
||||
output = @engine.render(scope, locals, &block)
|
||||
|
||||
output
|
||||
@engine.render(scope, locals, &block)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -101,8 +101,8 @@ module Middleman
|
|||
|
||||
preexisting_load_paths = begin
|
||||
::Sass.load_paths
|
||||
rescue StandardError
|
||||
[]
|
||||
rescue StandardError
|
||||
[]
|
||||
end
|
||||
|
||||
more_opts = {
|
||||
|
|
|
@ -108,9 +108,10 @@ module Middleman
|
|||
else
|
||||
inner_path = sub_resource.path.sub(prefix, '')
|
||||
parts = inner_path.split('/')
|
||||
if parts.length == 1
|
||||
case parts.length
|
||||
when 1
|
||||
true
|
||||
elsif parts.length == 2
|
||||
when 2
|
||||
parts.last == @app.config[:index_file]
|
||||
else
|
||||
false
|
||||
|
|
|
@ -60,9 +60,9 @@ module Middleman
|
|||
@priority = priority
|
||||
@vertices = ::Hamster::Set.empty
|
||||
|
||||
source = Pathname(source) if source&.is_a?(String)
|
||||
source = Pathname(source) if source.is_a?(String)
|
||||
|
||||
@file_descriptor = if source&.is_a?(Pathname)
|
||||
@file_descriptor = if source.is_a?(Pathname)
|
||||
::Middleman::SourceFile.new(source.relative_path_from(@app.source_dir), source, @app.source_dir, Set.new([:source]), 0)
|
||||
else
|
||||
source
|
||||
|
|
|
@ -102,9 +102,7 @@ module Middleman
|
|||
)
|
||||
end
|
||||
|
||||
if should_run? :ignored, only
|
||||
@_lookup_by_ignored = @_lookup_by_ignored << resource if resource.ignored?
|
||||
end
|
||||
@_lookup_by_ignored = @_lookup_by_ignored << resource if should_run?(:ignored, only) && resource.ignored?
|
||||
end
|
||||
|
||||
Contract Resource => Any
|
||||
|
|
|
@ -135,16 +135,14 @@ module Middleman
|
|||
|
||||
@vertices <<= ::Middleman::Dependencies::FileVertex.from_source_file(@app, partial_file)
|
||||
|
||||
result = if (r && !r.template?) || (Tilt[partial_file[:full_path]].nil? && partial_file[:full_path].exist?)
|
||||
partial_file.read
|
||||
else
|
||||
opts = options_hash.dup
|
||||
locs = locals
|
||||
if (r && !r.template?) || (Tilt[partial_file[:full_path]].nil? && partial_file[:full_path].exist?)
|
||||
partial_file.read
|
||||
else
|
||||
opts = options_hash.dup
|
||||
locs = locals
|
||||
|
||||
render_file(partial_file, locs, opts, &block)
|
||||
end
|
||||
|
||||
result
|
||||
render_file(partial_file, locs, opts, &block)
|
||||
end
|
||||
end
|
||||
|
||||
# Locate a partial relative to the current path or the source dir, given a partial's path.
|
||||
|
|
|
@ -28,9 +28,10 @@ module Middleman
|
|||
# @return [Hash]
|
||||
Contract Hash => IsA['::Middleman::Util::EnhancedHash']
|
||||
def recursively_enhance(obj)
|
||||
if obj.is_a? ::Array
|
||||
case obj
|
||||
when ::Array
|
||||
obj.map { |e| recursively_enhance(e) }
|
||||
elsif obj.is_a? ::Hash
|
||||
when ::Hash
|
||||
EnhancedHash.new(obj)
|
||||
else
|
||||
obj
|
||||
|
@ -119,9 +120,9 @@ module Middleman
|
|||
::Middleman::Util.instrument 'parse.yaml' do
|
||||
::YAML.load(content)
|
||||
end
|
||||
rescue StandardError, ::Psych::SyntaxError => e
|
||||
warn "YAML Exception parsing #{full_path}: #{e.message}"
|
||||
{}
|
||||
rescue StandardError, ::Psych::SyntaxError => e
|
||||
warn "YAML Exception parsing #{full_path}: #{e.message}"
|
||||
{}
|
||||
end
|
||||
|
||||
c ? symbolize_recursive(c) : {}
|
||||
|
@ -137,9 +138,9 @@ module Middleman
|
|||
::Middleman::Util.instrument 'parse.json' do
|
||||
::JSON.parse(content)
|
||||
end
|
||||
rescue StandardError => e
|
||||
warn "JSON Exception parsing #{full_path}: #{e.message}"
|
||||
{}
|
||||
rescue StandardError => e
|
||||
warn "JSON Exception parsing #{full_path}: #{e.message}"
|
||||
{}
|
||||
end
|
||||
|
||||
c ? symbolize_recursive(c) : {}
|
||||
|
|
Loading…
Reference in New Issue