erikw/nestedtext-ruby

View on GitHub
lib/nestedtext/parser.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Class Parser has 24 methods (exceeds 20 allowed). Consider refactoring.
Wontfix

  class Parser # rubocop:disable Metrics/ClassLength
    def self.assert_valid_top_level_type(top_class)
      if !top_class.nil? && top_class.is_a?(Class) && TOP_LEVEL_TYPES.map(&:object_id).include?(top_class.object_id)
        return
      end
Severity: Minor
Found in lib/nestedtext/parser.rb - About 2 hrs to fix

    Method deserialize_custom_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        def deserialize_custom_class(hash, first_line)
          return hash unless !@strict && hash.length == 2 && hash.key?(CUSTOM_CLASS_KEY)
    
          class_name = hash[CUSTOM_CLASS_KEY]
          begin
    Severity: Minor
    Found in lib/nestedtext/parser.rb - About 45 mins to fix

    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 parse_dict_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        def parse_dict_item(indentation)
          result = {}
          first_line = nil
          while !@line_scanner.peek.nil? && @line_scanner.peek.indentation >= indentation
            line = @line_scanner.read_next
    Severity: Minor
    Found in lib/nestedtext/parser.rb - About 25 mins to fix

    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 parse_list_item_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        def parse_list_item_value(indentation, value)
          return value unless value.nil?
    
          if !@line_scanner.peek.nil? && @line_scanner.peek.indentation > indentation
            parse_any(@line_scanner.peek.indentation)
    Severity: Minor
    Found in lib/nestedtext/parser.rb - About 25 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status