Showing 13 of 24 total issues

Class Archive has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Archive
    include Serializable

    def self.from_string(str, uri = nil)
      new JSON.parse(str), uri
Severity: Minor
Found in lib/har/archive.rb - About 2 hrs to fix

    File harSchema.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* See license.txt for terms of usage */
    
    define("preview/harSchema", [], function() {
    
    // ************************************************************************************************
    Severity: Minor
    Found in lib/har/viewer/scripts/preview/harSchema.js - About 2 hrs to fix

      File domplate.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      
      define("domplate/domplate",[],function(){Domplate={};(function(){function DomplateTag(tagName)
      {this.tagName=tagName;}
      this.DomplateTag=DomplateTag;function DomplateEmbed()
      {}
      Severity: Minor
      Found in lib/har/viewer/scripts/domplate/domplate.js - About 2 hrs to fix

        Function compileDOM has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        continue;map[name]=1;var names=name.split(".");blocks.push('var ',names[0]+' = '+'__in__.'+names[0]+';\n');}},compileDOM:function()
        {var path=[];var blocks=[];this.domArgs=[];path.embedIndex=0;path.loopIndex=0;path.staticIndex=0;path.renderIndex=0;var nodeCount=this.generateDOM(path,blocks,this.domArgs);var fnBlock=['(function (root, context, o'];for(var i=0;i<path.staticIndex;++i)
        fnBlock.push(', ','s'+i);for(var i=0;i<path.renderIndex;++i)
        fnBlock.push(', ','d'+i);fnBlock.push(') {\n');for(var i=0;i<path.loopIndex;++i)
        fnBlock.push('var l',i,' = 0;\n');for(var i=0;i<path.embedIndex;++i)
        Severity: Minor
        Found in lib/har/viewer/scripts/domplate/domplate.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

          {for(var j=0;j<part.format.length;++j)
          partName=part.format[j]+"("+partName+")";}
          Severity: Major
          Found in lib/har/viewer/scripts/domplate/domplate.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

            {var className=name.substr(1);if(!this.classes)
            this.classes={};this.classes[className]=val;}
            Severity: Major
            Found in lib/har/viewer/scripts/domplate/domplate.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

              {for(var j=0;j<part.format.length;++j)
              varName=part.format[j]+'('+varName+')';}
              Severity: Major
              Found in lib/har/viewer/scripts/domplate/domplate.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                {if(name=="class"&&name in this.attrs)
                this.attrs[name]+=" "+val;else
                this.attrs[name]=val;}}},compile:function()
                Severity: Major
                Found in lib/har/viewer/scripts/domplate/domplate.js - About 45 mins to fix

                  Function addParts has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function addParts(val,delim,block,info,escapeIt)
                  Severity: Minor
                  Found in lib/har/viewer/scripts/domplate/domplate.js - About 35 mins to fix

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

                        def validate_if_needed(hars)
                          return hars unless @options[:validate]
                    
                          progress("Validating archives...") {
                            Array(hars).map { |har|
                    Severity: Minor
                    Found in lib/har/viewer.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 entries_before has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def entries_before(time)
                          raise TypeError, "expected Time" unless time.is_a?(Time)
                          entries.select do |entry|
                            next(false) unless entry.time
                            entry.started_date_time + entry.time / 1000.0 <= time
                    Severity: Minor
                    Found in lib/har/page.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 by_merging has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.by_merging(hars)
                          hars = hars.dup
                    
                          result = hars.shift or raise ArgumentError, "no HARs given"
                          result = from_file(result) unless result.kind_of? self
                    Severity: Minor
                    Found in lib/har/archive.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 entries_before has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def entries_before(time)
                          raise TypeError, "expected Time" unless time.is_a?(Time)
                          entries.select do |entry|
                            next(false) unless entry.time
                            entry.started_date_time + entry.time / 1000.0 <= time
                    Severity: Minor
                    Found in lib/har/archive.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