arashm/PoParser

View on GitHub

Showing 5 of 5 total issues

Class Po has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Po
    include Enumerable
    attr_reader :header
    attr_accessor :path

Severity: Minor
Found in lib/poparser/po.rb - About 2 hrs to fix

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

        def to_h
          instance_variables.each_with_object({}) do |label, hash|
            object = instance_variable_get(label)
            # If it's a plural msgstr
            if object.is_a?(Array)
    Severity: Minor
    Found in lib/poparser/entry.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_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_s(with_label = false)
          return to_str unless with_label
    
          if @value.is_a? Array
            if /^previous_/.match?(@type.to_s) # these behave more like messages
    Severity: Minor
    Found in lib/poparser/comment.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_s
          string = []
          if @comments.is_a?(Array)
            @comments.each do |comment|
              string << "# #{comment}".strip
    Severity: Minor
    Found in lib/poparser/header.rb - About 35 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 inspect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def inspect
          string = []
          if @comments.is_a?(Array)
            @comments.each do |comment|
              string << "# #{comment}".strip
    Severity: Minor
    Found in lib/poparser/header.rb - About 35 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