Showing 102 of 115 total issues

Function streamOneP4File has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def streamOneP4File(self, file, contents):
        """Output one file from the P4 stream.

           This is a helper for streamP4Files().
           """
Severity: Minor
Found in git-p4.py - 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

Function gitCommitByP4Change has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def gitCommitByP4Change(self, ref, change):
        if self.verbose:
            print("looking in ref " + ref + " for change %s using bisect..." % change)

        earliestCommit = ""
Severity: Minor
Found in git-p4.py - 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

Function prepareLogMessage has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def prepareLogMessage(self, template, message, jobs):
        """Edits the template returned from "p4 change -o" to insert the
           message in the Description field, and the jobs text in the Jobs
           field.
           """
Severity: Minor
Found in git-p4.py - 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

Function handleLine has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function handleLine(commit, group) {
    /*
       This is the structure of the HTML fragment we are working
       with:

Severity: Major
Found in gitweb/static/js/blame_incremental.js - About 2 hrs to fix

    Function run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, args):
            if len(args) < 1:
                return False
    
            if self.keepRepoPath and not self.cloneDestination:
    Severity: Minor
    Found in git-p4.py - 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

    Function findUpstreamBranchPoint has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def findUpstreamBranchPoint(head="HEAD"):
        branches = p4BranchesInGit()
        # map from depot-path to branch name
        branchByDepotPath = {}
        for branch in branches.keys():
    Severity: Minor
    Found in git-p4.py - 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

    Function stripRepoPath has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def stripRepoPath(self, path, prefixes):
            """When streaming files, this is called to map a p4 depot path to where
               it should go in git.  The prefixes are either self.depotPaths, or
               self.branchPrefixes in the case of branch detection.
               """
    Severity: Minor
    Found in git-p4.py - 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

    Function p4_check_access has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def p4_check_access(min_expiration=1):
        """Check if we can access Perforce - account still logged in."""
    
        results = p4CmdList(["login", "-s"])
    
    
    Severity: Minor
    Found in git-p4.py - 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

    Function p4Where has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def p4Where(depotPath):
        if not depotPath.endswith("/"):
            depotPath += "/"
        depotPathLong = depotPath + "..."
        outputList = p4CmdList(["where", depotPathLong])
    Severity: Minor
    Found in git-p4.py - 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

    Function findShadowedFiles has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def findShadowedFiles(self, files, change):
            """Perforce allows you commit files and directories with the same name,
               so you could have files //depot/foo and //depot/foo/bar both checked
               in.  A p4 sync of a repository in this state fails.  Deleting one of
               the files recovers the repository.
    Severity: Minor
    Found in git-p4.py - 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

    Function importHeadRevision has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def importHeadRevision(self, revision):
            print("Doing initial import of %s from revision %s into %s" % (' '.join(self.depotPaths), revision, self.branch))
    
            details = {}
            details["user"] = "git perforce import user"
    Severity: Minor
    Found in git-p4.py - 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

    Function processBlameLines has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function processBlameLines(lines) {
        var match;
    
        for (var i = 0, len = lines.length; i < len; i++) {
    
    
    Severity: Minor
    Found in gitweb/static/js/blame_incremental.js - 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

    Function splitFilesIntoBranches has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def splitFilesIntoBranches(self, commit):
            """Look at each depotFile in the commit to figure out to what branch it
               belongs.
               """
    
    
    Severity: Minor
    Found in git-p4.py - 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

    Function processBlameLines has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function processBlameLines(lines) {
        var match;
    
        for (var i = 0, len = lines.length; i < len; i++) {
    
    
    Severity: Major
    Found in gitweb/static/js/blame_incremental.js - About 2 hrs to fix

      Function update_client_spec_path_cache has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_client_spec_path_cache(self, files):
              """Caching file paths by "p4 where" batch query."""
      
              # List depot file paths exclude that already cached
              fileArgs = [f['path'] for f in files if decode_path(f['path']) not in self.client_spec_path_cache]
      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 processContent has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def processContent(self, git_mode, relPath, contents):
              """Processes the content of git fast import. This method decides if a
                 file is stored in the large file system and handles all necessary
                 steps.
                 """
      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 setCookie has a Cognitive Complexity of 14 (exceeds 5 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

      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 streamP4Files has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def streamP4Files(self, files):
              """Stream directly from "p4 files" into "git fast-import."""
      
              filesForCommit = []
              filesToRead = []
      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 get_diff_description has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_diff_description(self, editedFiles, filesToAdd, symlinks):
              # diff
              if "P4DIFF" in os.environ:
                  del(os.environ["P4DIFF"])
              diff = ""
      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 applyCommit has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def applyCommit(self, id):
              """Apply one commit, return True if it succeeded."""
      
              print("Applying", read_pipe(["git", "show", "-s",
                                           "--format=format:%h %s", id]))
      Severity: Minor
      Found in git-p4.py - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language