New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An error occurred while Style/Next cop was inspecting #10939
Labels
Comments
It seems that part of the reproduction code is missing. Can you provide a complete parseable reproduction code? |
def self.get_deps_list(pkgName = name, hash: false, include_build_deps: 'auto', include_self: false,
pkgTags: [], highlight_build_deps: true, exclude_buildessential: false, top_level: true)
# get_deps_list: get dependencies list of pkgName (current package by default)
#
# pkgName: package to check dependencies, current package by default
# hash: return result in nested hash, used by `print_deps_tree` (`bin/crew`)
#
# include_build_deps: if set to true, force all build dependencies to be returned.
# if set to false, all build dependencies will not be returned
# if set to "auto" (default), return build dependencies if pre-built binaries not available
#
# include_self: include #{pkgName} itself in returned result, only used in recursive calls (see `expandedDeps` below)
# highlight_build_deps: include corresponding symbols in return value, you can convert it to actual ascii color codes later
# exclude_buildessential: do not insert `buildessential` dependency automatically
#
# top_level: if set to true, return satisfied dependencies
# (dependencies that might be a sub-dependency of a dependency that checked before),
# always set to false if this function is called in recursive loop (see `expandedDeps` below)
#
@checked_list ||= {} # create @checked_list placeholder if not exist
# add current package to @checked_list for preventing extra checks
@checked_list.merge!({ pkgName => pkgTags })
pkgObj = load_package("#{CREW_PACKAGES_PATH}/#{pkgName}.rb")
is_source = pkgObj.is_source?(ARCH.to_sym) or pkgObj.build_from_source
deps = pkgObj.dependencies
# append buildessential to deps if building from source is needed/specified
if ((include_build_deps == true) || ((include_build_deps == 'auto') && is_source)) && \
!pkgObj.no_compile_needed? && \
!exclude_buildessential && \
!@checked_list.keys.include?('buildessential')
deps = { 'buildessential' => [:build] }.merge(deps)
end
# parse dependencies recursively
expandedDeps = deps.uniq.map do |dep, depTags|
# check build dependencies only if building from source is needed/specified
if (include_build_deps == true) || \
((include_build_deps == 'auto') && is_source) || \
!depTags.include?(:build)
# overwrite tags if parent dependency is a build dependency
# (for build dependencies highlighting)
tags = pkgTags.include?(:build) ? pkgTags : depTags
if @checked_list.keys.none?(dep)
# check dependency by calling this function recursively
next send(__method__, dep,
hash: hash,
pkgTags: tags,
include_build_deps: include_build_deps,
highlight_build_deps: highlight_build_deps,
exclude_buildessential: exclude_buildessential,
include_self: true,
top_level: false)
elsif hash && top_level
# will be dropped here if current dependency is already checked and #{top_level} is set to true
#
# the '+' symbol tell `print_deps_tree` (`bin/crew`) to color this package as "satisfied dependency"
# the '*' symbol tell `print_deps_tree` (`bin/crew`) to color this package as "build dependency"
if highlight_build_deps && tags.include?(:build)
next { "+*#{dep}*+" => [] }
elsif highlight_build_deps
next { "+#{dep}+" => [] }
else
next { dep => [] }
end
end
end
end.compact
if hash
# the '*' symbol tell `print_deps_tree` (`bin/crew`) to color this package as "build dependency"
if highlight_build_deps && pkgTags.include?(:build)
return { "*#{pkgName}*" => expandedDeps }
else
return { pkgName => expandedDeps }
end
elsif include_self
# return pkgName itself if this function is called as a recursive loop (see `expandedDeps`)
return [expandedDeps, pkgName].flatten
else
# if this function is called outside of this function, return parsed dependencies only
return expandedDeps.flatten
end
end
boolean_property.each do |prop|
self.class.__send__(:attr_reader, prop.to_s)
class_eval <<~EOT, __FILE__, __LINE__ + 1
def self.#{prop} (#{prop} = nil)
@#{prop} = true if #{prop}
!!@#{prop}
end
EOT
instance_eval <<~EOY, __FILE__, __LINE__ + 1
def self.#{prop}
@#{prop} = true
end
EOY
# Adds the symbol? method
define_singleton_method("#{prop}?") do
@prop = instance_variable_get("@#{prop}")
!!@prop
end
end |
I've narrowed it down to this: foo = map do |dep|
if ((true == true) || \
!frob.include?) && @test.keys?
next send(dep,
hash: hash,
test: test)
end
end.compact |
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this issue
Aug 21, 2022
Fixes rubocop#10939. This PR fixes an error for `Style/Next` when line break before condition. The removed indentation logic can be delegated to `Layout/IndentationConsistency`.
bbatsov
pushed a commit
that referenced
this issue
Aug 22, 2022
Fixes #10939. This PR fixes an error for `Style/Next` when line break before condition. The removed indentation logic can be delegated to `Layout/IndentationConsistency`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The aforementioned line of code:
RuboCop version
The text was updated successfully, but these errors were encountered: