jbussdieker/ruby-net-ip

View on GitHub

Showing 5 of 5 total issues

Method parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse(data)
          list = []
          in_default = false
          data.each_line do |line|
            if in_default == true
Severity: Minor
Found in lib/net/ip/route/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 parse_line has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse_line(line)
          params = {}

          if line =~ /^(unicast|unreachable|blackhole|prohibit|local|broadcast|throw|nat|via|anycast|multicast)\s+/
            params[:type] = $1
Severity: Minor
Found in lib/net/ip/route/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 to_h has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def to_h
        h = {}
        h[:prefix] = @prefix if @prefix
        h[:via] = @via if @via
        h[:dev] = @dev if @dev
Severity: Minor
Found in lib/net/ip/route.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 to_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def to_params
        str = ""
        str << "via #{@via} " if @via
        str << "dev #{@dev} " if @dev
        str << "weight #{@weight}" if @weight
Severity: Minor
Found in lib/net/ip/route.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_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse_line(line)
          params = {}
          params[:priority] = $1 if line =~ /^(\d+):\t/
          params[:from] = $1 if line =~ /\s+from\s+([^\s]+)\s+/
          params[:to] = $1 if line =~ /\s+to\s+([^\s]+)\s+/
Severity: Minor
Found in lib/net/ip/rule/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

Severity
Category
Status
Source
Language