Showing 102 of 115 total issues

File git-p4.py has 3465 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
#
# git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
#
# Author: Simon Hausmann <simon@lst.de>
Severity: Major
Found in git-p4.py - About 1 wk to fix

    Function applyCommit has a Cognitive Complexity of 160 (exceeds 5 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 3 days 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 run has a Cognitive Complexity of 131 (exceeds 5 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 2 days 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 run has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, args):
            if self.importIntoRemotes:
                self.refPrefix = "refs/remotes/p4/"
            else:
                self.refPrefix = "refs/heads/p4/"
    Severity: Minor
    Found in git-p4.py - About 2 days 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 importChanges has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
    Open

        def importChanges(self, changes, origin_revision=0):
            cnt = 1
            for change in changes:
                description = p4_describe(change)
                self.updateOptionDict(description)
    Severity: Minor
    Found in git-p4.py - About 1 day 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 p4CmdList has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

    def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
            errors_as_exceptions=False, *k, **kw):
    
        cmd = p4_build_cmd(["-G"] + cmd)
        if verbose:
    Severity: Minor
    Found in git-p4.py - About 1 day 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 importRevisions has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        def importRevisions(self, args, branch_arg_given):
            changes = []
    
            if len(self.changesFile) > 0:
                with open(self.changesFile) as f:
    Severity: Minor
    Found in git-p4.py - About 7 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 metadata_stream_to_writable_bytes has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    def metadata_stream_to_writable_bytes(s):
        encodingStrategy = gitConfig('git-p4.metadataDecodingStrategy') or defaultMetadataDecodingStrategy
        fallbackEncoding = gitConfig('git-p4.metadataFallbackEncoding') or defaultFallbackMetadataEncoding
        if not isinstance(s, bytes):
            return s.encode('utf_8')
    Severity: Minor
    Found in git-p4.py - About 6 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 a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    function handleLine(commit, group) {
        /*
           This is the structure of the HTML fragment we are working
           with:
    
    
    Severity: Minor
    Found in gitweb/static/js/blame_incremental.js - About 6 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 importP4Labels has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def importP4Labels(self, stream, p4Labels):
            """Import p4 labels as git tags. A direct mapping does not exist, so
               assume that if all the files are at the same revision then we can
               use that, or it's something more complicated we should just ignore.
               """
    Severity: Minor
    Found in git-p4.py - About 5 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 commit has a Cognitive Complexity of 37 (exceeds 5 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 5 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 exportGitTags has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def exportGitTags(self, gitTags):
            """Export git tags as p4 labels. Create a p4 label and then tag with
               that.
               """
    
    
    Severity: Minor
    Found in git-p4.py - About 5 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 p4ChangesForPaths has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
        assert depotPaths
    
        # Parse the change range into start and end. Try to find integer
        # revision ranges as these can be broken up into blocks to avoid
    Severity: Minor
    Found in git-p4.py - About 5 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 getBranchMapping has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def getBranchMapping(self):
            lostAndFoundBranches = set()
    
            user = gitConfig("git-p4.branchUser")
    
    
    Severity: Minor
    Found in git-p4.py - About 4 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

    P4Sync has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class P4Sync(Command, P4UserMap):
    
        def __init__(self):
            Command.__init__(self)
            P4UserMap.__init__(self)
    Severity: Minor
    Found in git-p4.py - About 4 hrs to fix

      File blame_incremental.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright (C) 2007, Fredrik Kuivinen <frekui@gmail.com>
      //               2007, Petr Baudis <pasky@suse.cz>
      //          2008-2011, Jakub Narebski <jnareb@gmail.com>
      
      /**
      Severity: Minor
      Found in gitweb/static/js/blame_incremental.js - About 4 hrs to fix

        Function streamP4FilesCb has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def streamP4FilesCb(self, marshalled):
                """Handle another chunk of streaming data."""
        
                # catch p4 errors and complain
                err = None
        Severity: Minor
        Found in git-p4.py - About 4 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 prepareSubmitTemplate has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def prepareSubmitTemplate(self, changelist=None):
                """Run "p4 change -o" to grab a change specification template.
        
                   This does not use "p4 -G", as it is nice to keep the submission
                   template in original order, since a human might edit it.
        Severity: Minor
        Found in git-p4.py - About 4 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 createOrUpdateBranchesFromOrigin has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        def createOrUpdateBranchesFromOrigin(localRefPrefix="refs/remotes/p4/", silent=True):
            if not silent:
                print("Creating/updating branch(es) in %s based on origin branch(es)"
                       % localRefPrefix)
        
        
        Severity: Minor
        Found in git-p4.py - About 4 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 main has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        def main():
            if len(sys.argv[1:]) == 0:
                printUsage(commands.keys())
                sys.exit(2)
        
        
        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

        Severity
        Category
        Status
        Source
        Language