Showing 359 of 503 total issues
Avoid too many return
statements within this method. Open
return false unless switch_additional_rules # It's ok for them to be empty, but false denotes a mismatch
Avoid too many return
statements within this method. Open
return expand_path parts[0].split('/')[0...-1].join('/')
Avoid too many return
statements within this method. Open
return expand_path parts.join('/')
Method write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write(object = @object)
if idx = @cache.index(object.object_id)
write_object_link(idx)
elsif object.respond_to?(:marshal_dump)
write_usr_marshal(object)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method uniq
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def uniq(&block)
hash = {}
each do |*args|
value = ::Opal.destructure(args)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method round
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def round(precision = 0)
return with_precision(:round, precision) unless precision == 0
return 0 if @num == 0
return @num if @den == 1
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method clone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def clone(freeze: nil)
unless freeze.nil? || freeze == true || freeze == false
raise ArgumentError, "unexpected value for freeze: #{freeze.class}"
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method repeated_permutation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def repeated_permutation(n)
num = ::Opal.coerce_to! n, ::Integer, :to_int
return enum_for(:repeated_permutation, num) { num >= 0 ? size**num : 0 } unless block_given?
%x{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method absolute_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def absolute_path(path, basedir = nil)
sep = SEPARATOR
sep_chars = `$sep_chars()`
new_parts = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method segment_from_fragment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def segment_from_fragment(fragment, generated_column)
source_index = 0 # always 0, we're dealing with a single file
original_line = (fragment.line || 0) - 1 # fragments have 1-based lines
original_line = 0 if original_line < 0 # line 0 (-1) for fragments in source maps will crash
# browsers devtools and the webpack build process
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_builder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_builder
builder = Opal::Builder.new(
stubs: stubs,
compiler_options: compiler_options,
missing_require_severity: missing_require_severity,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compile_defined_send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compile_defined_send(node)
recv, method_name, *args = *node
mid = mid_to_jsid(method_name.to_s)
if recv
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method inspect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inspect
result = '#<struct '
if `inspect_stack`.include? __id__
result + ':...>'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method source_location
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def source_location
expr = @sexp.loc.expression
if expr.respond_to? :source_buffer
file = expr.source_buffer.name
file = "<internal:#{file}>" if file.start_with?("corelib/")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compile_body
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compile_body
inline_params = nil
scope_name = nil
in_scope do
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method normal?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normal?
Matrix.Raise ErrDimensionMismatch unless square?
rows.each_with_index do |row_i, i|
rows.each_with_index do |row_j, j|
s = 0
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compile_call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compile_call
yielding_scope = find_yielding_scope
yielding_scope.uses_block!
yielding_scope.block_name ||= '$yield'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run
mktmpdir do |dir|
with_http_server(dir) do |http_port, server_thread|
with_safari_driver do
prepare_files_in(dir)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method with_http_server
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def with_http_server(dir)
port = safari_driver_port.to_i + 1
server_thread = Thread.new do
server = WEBrick::HTTPServer.new(Port: port, DocumentRoot: dir, Logger: WEBrick::Log.new('/dev/null'), AccessLog: [])
server.mount_proc('/log') do |req, res|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compile_arguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compile_arguments(skip_comma = false)
push ', ' unless skip_comma
if @with_writer_temp
push @with_writer_temp
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"