Showing 58 of 58 total issues
Method visit_tag_attributes
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_tag_attributes(node, indent:)
final_line_index = node.line - 1
additional_attributes = node.dynamic_attributes_sources
attributes_code = additional_attributes.first
Method contains_class_attribute?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def contains_class_attribute?(attributes_sources)
attributes_sources.each do |code|
ast_root = parse_ruby(surrounded_by_braces?(code) ? code : "{#{code}}")
next unless ast_root # RuboCop linter will report syntax errors
- 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 transfer_correction_logic
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transfer_correction_logic(_coordinator, to_ruby_lines, haml_lines) # rubocop:disable Metrics
return if @ruby_lines == to_ruby_lines
affected_haml_lines = haml_lines[@haml_line_index..haml_end_line_index]
Method extract_raw_tag_attributes_ruby_lines
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_raw_tag_attributes_ruby_lines(haml_processed_ruby_code, first_line_index)
haml_processed_ruby_code = haml_processed_ruby_code.strip
first_line = @original_haml_lines[first_line_index]
char_index = first_line.index(haml_processed_ruby_code)
Method rubocop_autocorrect_flags
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def rubocop_autocorrect_flags
return [] unless @autocorrect
rubocop_version = Gem::Version.new(::RuboCop::Version::STRING)
- 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 for_consecutive_items
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def for_consecutive_items(items, satisfies, min_consecutive = 2)
current_index = -1
while (current_index += 1) < items.count
next unless satisfies[items[current_index]]
- 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 finish_visit_any_script
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def finish_visit_any_script(node, lines, raw_code: nil, must_start_chunk: false, first_output_prefix: '=')
raw_code ||= lines.join("\n")
start_nesting = self.class.start_nesting_after?(raw_code)
lines = add_following_empty_lines(node, lines)
- 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 check_character
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_character(character, root)
wrong_characters = character == :space ? 'tabs' : 'spaces'
regex = INDENT_REGEX[character]
dummy_node = Struct.new(:line)
- 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 parsed_script
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parsed_script
statement =
case keyword = @value[:keyword]
when 'else', 'elsif'
'if 0;' + script + ';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 extract_raw_ruby_lines
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_raw_ruby_lines(haml_processed_ruby_code, first_line_index)
haml_processed_ruby_code = haml_processed_ruby_code.strip
first_line = @original_haml_lines[first_line_index]
char_index = first_line.index(haml_processed_ruby_code)
- 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 act_on_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def act_on_options(options) # rubocop:disable Metrics
configure_logger(options)
if options[:debug]
ENV['HAML_LINT_DEBUG'] = 'true'
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 visit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit(node)
# Keep track of whether this block was consumed by the visitor. This
# allows us to visit all nodes by default, but can override the behavior
# by specifying `yield false` in a visit method, indicating that no
# further visiting should occur for the current node's children.
- 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 visit_tag_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit_tag_attributes(node, indent:)
final_line_index = node.line - 1
additional_attributes = node.dynamic_attributes_sources
attributes_code = additional_attributes.first
- 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 visit_tag
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit_tag(node) # rubocop:disable Metrics/CyclomaticComplexity
# If this tag has inline script
return unless node.contains_script?
text = node.script.strip
- 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 visit_tag
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit_tag(node)
return unless node.hash_attributes?
style = STYLE[config['style'] == 'no_space' ? 'no_space' : 'space']
source = node.hash_attributes_source
- 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 new_haml_validity_checks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_haml_validity_checks(new_haml_string)
new_haml_error = HamlLint::Utils.check_error_when_compiling_haml(new_haml_string)
return true unless new_haml_error
error_message = if new_haml_error.is_a?(::SyntaxError)
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(linter, filename, line, message, severity = :warning, corrected: false) # rubocop:disable Metrics/ParameterLists
Method visit_filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visit_filter(node)
# For unknown reasons, haml doesn't escape interpolations in filters.
# So we can rely on \n to split / get the number of lines.
filter_name_indent = @original_haml_lines[node.line - 1].index(/\S/)
if node.filter_type == 'ruby'
- 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 process_source
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_source(source) # rubocop:disable Metrics/MethodLength
@source = process_encoding(source)
@source = strip_frontmatter(source)
# the -1 is to keep the empty strings at the end of the array when the source
# ended with multiple new-lines
- 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 node_for_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def node_for_line(line) # rubocop:disable Metrics
each do |node|
return node if node.line_numbers.cover?(line) && node != self
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"