Showing 102 of 115 total issues

Function __init__ has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self):
        Command.__init__(self)
        P4UserMap.__init__(self)
        self.options = [
                optparse.make_option("--branch", dest="branch"),
Severity: Minor
Found in git-p4.py - About 1 hr to fix

    Function run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run(self, args):
            if len(args) == 0:
                self.master = currentGitBranch()
            elif len(args) == 1:
                self.master = args[0]
    Severity: Minor
    Found in git-p4.py - About 1 hr to fix

      Function handleResponse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function handleResponse(xhr, fromTimer) {
      
          /*
           * xhr.readyState
           *
      Severity: Minor
      Found in gitweb/static/js/blame_incremental.js - About 1 hr to fix

        Function setCookie has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function setCookie(sName, sValue, options) {
            options = options || {};
            if (sValue === null) {
                sValue = '';
                option.expires = 'delete';
        Severity: Minor
        Found in gitweb/static/js/lib/cookies.js - About 1 hr to fix

          Function extractSettingsGitLog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def extractSettingsGitLog(log):
              values = {}
              for line in log.split("\n"):
                  line = line.strip()
                  m = re.search(r"^ *\[git-p4: (.*)\]$", line)
          Severity: Minor
          Found in git-p4.py - 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

          Function getLabels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def getLabels(self):
                  """Build a dictionary of changelists and labels, for "detect-labels"
                     option.
                     """
          
          
          Severity: Minor
          Found in git-p4.py - 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

          Function fixColorsAndGroups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function fixColorsAndGroups() {
              var colorClasses = ['light', 'dark'];
              var linenum = 1;
              var tr, prev_group;
              var colorClass = 0;
          Severity: Minor
          Found in gitweb/static/js/blame_incremental.js - 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

          Function handleResponse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleResponse(xhr, fromTimer) {
          
              /*
               * xhr.readyState
               *
          Severity: Minor
          Found in gitweb/static/js/blame_incremental.js - 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

          Function decode_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def decode_path(path):
              """Decode a given string (bytes or otherwise) using configured path
                 encoding options.
                 """
          
          
          Severity: Minor
          Found in git-p4.py - 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

          Function modifyChangelistUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def modifyChangelistUser(self, changelist, newUser):
                  """Fixup the user field of a changelist after it has been submitted."""
                  changes = p4CmdList(["change", "-o", changelist])
                  if len(changes) != 1:
                      die("Bad output from p4 change modifying %s to user %s" %
          Severity: Minor
          Found in git-p4.py - 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

          Function isPathWanted has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def isPathWanted(self, path):
                  for p in self.cloneExclude:
                      if p.endswith("/"):
                          if p4PathStartsWith(path, p):
                              return False
          Severity: Minor
          Found in git-p4.py - 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

          Function commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def commit(self, details, files, branch, parent="", allow_empty=False):
                  epoch = details["time"]
                  author = details["user"]
                  jobs = self.extractJobsFromCommit(details)
          
          
          Severity: Minor
          Found in git-p4.py - About 1 hr to fix

            Function p4CmdList has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
            Severity: Major
            Found in git-p4.py - About 1 hr to fix

              Function getElementsByClassName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  document.getElementsByClassName = function (classname, taghint) {
                      taghint = taghint || "*";
                      var elements = (taghint === "*" && document.all) ?
                                     document.all :
                                     document.getElementsByTagName(taghint);
              Severity: Minor
              Found in gitweb/static/js/lib/common-lib.js - 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

              Function canChangeChangelists has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def canChangeChangelists(self):
                      """Check to see if we have p4 admin or super-user permissions, either
                         of which are required to modify changelists.
                         """
                      results = p4CmdList(["protects", self.depotPath])
              Severity: Minor
              Found in git-p4.py - 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

              Function getUserMapFromPerforceServer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def getUserMapFromPerforceServer(self):
                      if self.userMapFromPerforceServer:
                          return
                      self.users = {}
                      self.emails = {}
              Severity: Minor
              Found in git-p4.py - 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

              Function append has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def append(self, view_line):
                      """Parse a view line, splitting it into depot and client sides.  Append
                         to self.mappings, preserving order.  This is only needed for tag
                         creation.
                         """
              Severity: Minor
              Found in git-p4.py - 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

              Function p4_build_cmd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def p4_build_cmd(cmd):
                  """Build a suitable p4 command line.
              
                     This consolidates building and returning a p4 command line into one
                     location. It means that hooking into the environment, or other
              Severity: Minor
              Found in git-p4.py - 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

              Avoid deeply nested control flow statements.
              Open

                                      if not self.silent:
                                          print("p4 branch %s defines a mapping from %s to %s" % (info["branch"], source, destination))
                                          print("but there exists another mapping from %s to %s already!" % (self.knownBranches[destination], destination))
                                      continue
              Severity: Major
              Found in git-p4.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if parent == branch:
                                                parent = ""
                                            else:
                                                fullBranch = self.projectName + branch
                                                if fullBranch not in self.p4BranchesInGit:
                Severity: Major
                Found in git-p4.py - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language