grokify/versionone-sdk-ruby

View on GitHub

Showing 16 of 16 total issues

Method updateAsset has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def updateAsset(sAssetType=nil,sAssetOid=nil,sName=nil,xxValues=nil,yTagType=nil)
      aValues  = normalizeValues(xxValues)
      # Validate Tag Type
      yTagType = yTagType.to_sym if yTagType.is_a?(String)

Severity: Minor
Found in lib/versionone_sdk/update.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 getAsset has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def getAsset(xAssetId1, xAssetId2 = nil)
      xAssetId1.strip!

      if xAssetId1 =~ /^([^:]+):([0-9]+)$/
        sAssetType = $1
Severity: Minor
Found in lib/versionone_sdk/client.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 getJsondocForXmlAssetNode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def getJsondocForXmlAssetNode(oNodeAsset=nil)
      if oNodeAsset.nil?
        raise RuntimeError, 'E_NIL_NODE'
      end
      oAsset = VersiononeSdk::Asset.new
Severity: Minor
Found in lib/versionone_sdk/parser_xml_assets.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 getAssetNodeChildPropVal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def getAssetNodeChildPropVal(oNodeChild=nil)
      xxPropVal = nil
      aPropVals = []
      if oNodeChild.children.length > 0
        oNodeChild.children.each do |oNodeChildGrand|
Severity: Minor
Found in lib/versionone_sdk/parser_xml_assets.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 updateAsset has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def updateAsset(sAssetType=nil,sAssetOid=nil,sName=nil,xxValues=nil,yTagType=nil)
      aValues  = normalizeValues(xxValues)
      # Validate Tag Type
      yTagType = yTagType.to_sym if yTagType.is_a?(String)

Severity: Minor
Found in lib/versionone_sdk/update.rb - About 1 hr to fix

    Method getJsondocForXmlAssetNode has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def getJsondocForXmlAssetNode(oNodeAsset=nil)
          if oNodeAsset.nil?
            raise RuntimeError, 'E_NIL_NODE'
          end
          oAsset = VersiononeSdk::Asset.new
    Severity: Minor
    Found in lib/versionone_sdk/parser_xml_assets.rb - About 1 hr to fix

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

          def normalizeValues(xxValues=nil)
            aValues = []
      
            if xxValues.is_a?(String)
              aValues = [{value: xxValues, act: 'set'}]
      Severity: Minor
      Found in lib/versionone_sdk/update.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 getAsset has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def getAsset(xAssetId1, xAssetId2 = nil)
            xAssetId1.strip!
      
            if xAssetId1 =~ /^([^:]+):([0-9]+)$/
              sAssetType = $1
      Severity: Minor
      Found in lib/versionone_sdk/client.rb - About 1 hr to fix

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

            def initialize(opts = {})
              @sProtocol   = opts[:protocol] || DEFAULT_PROTOCOL
              @sHostname   = opts[:hostname] || DEFAULT_HOSTNAME
              @iPort       = opts.key?(:port) && opts[:port] \
                           ? opts[:port].to_i : DEFAULT_PORT
        Severity: Minor
        Found in lib/versionone_sdk/client.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 buildUrl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def buildUrl(sProtocol = DEFAULT_PROTOCOL, sHostname = DEFAULT_HOSTNAME, iPort = DEFAULT_PORT)
              if sHostname.nil?
                sHostname = 'localhost'
              elsif sHostname.is_a?(String)
                sHostname.strip!
        Severity: Minor
        Found in lib/versionone_sdk/client.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

        Avoid deeply nested control flow statements.
        Open

                    sAssetType = @dTypePrefix.key?(sAssetTypeAbbr) \
                      ? @dTypePrefix[ sAssetTypeAbbr ] : ''
        Severity: Major
        Found in lib/versionone_sdk/client.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    elsif xAssetId1 =~ /^[a-zA-Z].+$/
                      return self.getAssetForTypeAndOid(xAssetId1, xAssetId2)
          Severity: Major
          Found in lib/versionone_sdk/client.rb - About 45 mins to fix

            Method updateAsset has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def updateAsset(sAssetType=nil,sAssetOid=nil,sName=nil,xxValues=nil,yTagType=nil)
            Severity: Minor
            Found in lib/versionone_sdk/client.rb - About 35 mins to fix

              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/versionone_sdk/asset.rb - About 35 mins to fix

                Method updateAsset has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def updateAsset(sAssetType=nil,sAssetOid=nil,sName=nil,xxValues=nil,yTagType=nil)
                Severity: Minor
                Found in lib/versionone_sdk/update.rb - About 35 mins to fix

                  Method inflateNames has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def inflateNames()
                        dAssetState = {
                          0   => 'Future',
                          64  => 'Active',
                          128 => 'Closed',
                  Severity: Minor
                  Found in lib/versionone_sdk/asset.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