grokify/jsondoc-ruby

View on GitHub

Showing 9 of 198 total issues

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

    def getDescArrayForProperties(aCols = nil)
      aVals = []
      return aVals if aCols.nil?
      aCols.each do |yKey|
        yKey = yKey.to_sym if yKey.is_a? String
Severity: Minor
Found in lib/jsondoc/document.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 8 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(dValues=nil,dSchema=nil,bDefaultifyDoc=false,bIsStrict=true,opts={})
      @dSchema        = dSchema || self.getDefaultSchema()
      @bDefaultifyDoc = bDefaultifyDoc ? true : false
      @bIsStrict      = bIsStrict ? true : false
      @bUseKeyAsDesc  = false
Severity: Minor
Found in lib/jsondoc/document.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 validateKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validateKey(yKey = nil)
      raise ArgumentError, "E_BAD_KEY__IS_NIL [#{yKey.to_s}]" if yKey.nil?

      return true unless @bIsStrict

Severity: Minor
Found in lib/jsondoc/document.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(dValues=nil,dSchema=nil,bDefaultifyDoc=false,bIsStrict=true,opts={})
Severity: Minor
Found in lib/jsondoc/document.rb - About 35 mins to fix

    Method getDefaultDocument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def getDefaultDocument
          dDocument = {}
          if @bDefaultifyDoc && @dSchema.key?(:properties)
            @dSchema[:properties].keys.each do |yKey|
              dProperty = @dSchema[:properties][yKey]
    Severity: Minor
    Found in lib/jsondoc/document.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 getPropRecurse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def getPropRecurse(aKeys = [], dDoc = nil)
          yKey = aKeys.shift
          if ! yKey.is_a?(Symbol) || yKey.length<1 || ! dDoc.key?( yKey )
            return nil
          end
    Severity: Minor
    Found in lib/jsondoc/document.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 getPropSingle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def getPropSingle(yKey = nil)
          raise ArgumentError, 'E_BAD_KEY__IS_NIL' if yKey.nil?
          yKey = yKey.to_sym if yKey.is_a?(String)
          xxVal = @dDocument.key?(yKey) ? @dDocument[yKey] : nil
          if xxVal.nil? && @bIsStrict
    Severity: Minor
    Found in lib/jsondoc/document.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 pushProp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def pushProp(yKey = nil, xxVal = nil)
          yKey = yKey.to_sym if yKey.is_a?(String)
          self.validateKey(yKey)
    
          if @dDocument.key?(yKey)
    Severity: Minor
    Found in lib/jsondoc/document.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 getValArrayForProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def getValArrayForProperties(aCols = nil, xxNil = '')
          aVals = []
          return aVals if aCols.nil?
    
          if @bUseKeyAsDesc
    Severity: Minor
    Found in lib/jsondoc/document.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