pyrmont/taipo

View on GitHub

Showing 30 of 30 total issues

Method validate has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

      def self.validate(str)
        msg = "The argument to this method must be of type String."
        raise ::TypeError, msg unless str.is_a? String
        msg = "The string to be checked was empty."
        raise Taipo::SyntaxError, msg if str.empty?
Severity: Minor
Found in lib/taipo/parser/validater.rb - About 1 day 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 validate_constraints has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

      def self.validate_constraints(str, start: 0)
        status_array = [ :rpr, :hsh, :cln, :sls, :qut, :cma, :spc, :oth ]
        counter_array = [ [ :const ], { const: ":' or '#" } ]

        state = SyntaxState.new(status_array, counter_array)
Severity: Minor
Found in lib/taipo/parser/validater.rb - About 6 hrs 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 validate has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.validate(str)
        msg = "The argument to this method must be of type String."
        raise ::TypeError, msg unless str.is_a? String
        msg = "The string to be checked was empty."
        raise Taipo::SyntaxError, msg if str.empty?
Severity: Major
Found in lib/taipo/parser/validater.rb - About 3 hrs to fix

    Method validate_regex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.validate_regex(str, start: 0)
            status_array = [ :bsl, :sls, :opt, :oth ]
            counter_array = [ [ :backslash ], { backslash: '/' } ]
    
            state = SyntaxState.new(status_array, counter_array)
    Severity: Minor
    Found in lib/taipo/parser/validater.rb - About 3 hrs 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 validate_string has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.validate_string(str, start: 0)
            status_array = [ :bsl, :qut, :oth ]
            counter_array = [ [ :backslash ], { backslash: '/' } ]
    
            state = SyntaxState.new(status_array, counter_array)
    Severity: Minor
    Found in lib/taipo/parser/validater.rb - About 3 hrs 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 validate_constraints has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.validate_constraints(str, start: 0)
            status_array = [ :rpr, :hsh, :cln, :sls, :qut, :cma, :spc, :oth ]
            counter_array = [ [ :const ], { const: ":' or '#" } ]
    
            state = SyntaxState.new(status_array, counter_array)
    Severity: Major
    Found in lib/taipo/parser/validater.rb - About 2 hrs to fix

      Method object_to_type_def has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.object_to_type_def(obj)
            return obj.class.name unless obj.is_a? Enumerable
      
            if obj.is_a? Array
              element_types = Hash.new
      Severity: Minor
      Found in lib/taipo/utilities.rb - About 2 hrs 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 escape? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.escape?(c, states)
            if states[:esc]
              states[:esc] = false
              return skip, states
            end
      Severity: Minor
      Found in lib/taipo/parser.rb - About 1 hr 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 initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(name:, children: nil, constraints: nil)
            msg = 'Argument name was not a String.'
            raise ::TypeError, msg unless name.is_a? String
            msg = 'Argument name was an empty string.'
            raise ::ArgumentError if name.empty?
      Severity: Minor
      Found in lib/taipo/type_element.rb - About 1 hr 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_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_value(v)
              return nil if v == nil
      
              case @name
              when Constraint::METHOD
      Severity: Minor
      Found in lib/taipo/type_element/constraint.rb - About 1 hr 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_definition has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.parse_definition(str)
            Taipo::Parser::Validater.validate str
      
            stack = Taipo::Parser::Stack.new
            i = 0
      Severity: Minor
      Found in lib/taipo/parser.rb - About 1 hr to fix

        Method constrain? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def constrain?(arg)
                case @name
                when Constraint::METHOD
                  arg.respond_to? @value
                when 'format'
        Severity: Minor
        Found in lib/taipo/type_element/constraint.rb - About 1 hr 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 match_children? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def match_children?(arg)
              self_childless = @children.nil?
              arg_childless = !arg.is_a?(Enumerable) || arg.count == 0
              return true if self_childless
              return false if !self_childless && arg_childless
        Severity: Minor
        Found in lib/taipo/type_element.rb - About 1 hr 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 validate_regex has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.validate_regex(str, start: 0)
                status_array = [ :bsl, :sls, :opt, :oth ]
                counter_array = [ [ :backslash ], { backslash: '/' } ]
        
                state = SyntaxState.new(status_array, counter_array)
        Severity: Minor
        Found in lib/taipo/parser/validater.rb - About 1 hr to fix

          Method validate_string has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def self.validate_string(str, start: 0)
                  status_array = [ :bsl, :qut, :oth ]
                  counter_array = [ [ :backslash ], { backslash: '/' } ]
          
                  state = SyntaxState.new(status_array, counter_array)
          Severity: Minor
          Found in lib/taipo/parser/validater.rb - About 1 hr to fix

            Method constrain? has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def constrain?(arg)
                    case @name
                    when Constraint::METHOD
                      arg.respond_to? @value
                    when 'format'
            Severity: Minor
            Found in lib/taipo/type_element/constraint.rb - About 1 hr to fix

              Method object_to_type_def has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.object_to_type_def(obj)
                    return obj.class.name unless obj.is_a? Enumerable
              
                    if obj.is_a? Array
                      element_types = Hash.new
              Severity: Minor
              Found in lib/taipo/utilities.rb - About 1 hr to fix

                Method parse_constraint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.parse_constraint(str)
                      str.strip!
                      in_name = nil
                      name = ''
                      content = ''
                Severity: Minor
                Found in lib/taipo/parser.rb - About 55 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 check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check(context, collect_invalids = false, **checks)
                      msg = "The first argument to this method must be of type Binding."
                      raise ::TypeError, msg unless context.is_a? Binding
                
                      checks.reduce(Array.new) do |memo,(k,v)|
                Severity: Minor
                Found in lib/taipo/check.rb - About 55 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 match_class? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def match_class?(arg)
                      actual_name = (optional?) ? @name[0..-2] : @name
                      if actual_name == 'Boolean'
                        arg.is_a?(TrueClass) || arg.is_a?(FalseClass)
                      else
                Severity: Minor
                Found in lib/taipo/type_element.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

                Severity
                Category
                Status
                Source
                Language