Showing 102 of 115 total issues

Function checkValidP4Users has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def checkValidP4Users(self, commits):
        """Check if any git authors cannot be mapped to p4 users."""
        for id in commits:
            user, email = self.p4UserForCommit(id)
            if not user:
Severity: Minor
Found in git-p4.py - 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

Function generateTZList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function generateTZList() {
    var timezones = [
        { value: "utc",   descr: "UTC/GMT"},
        { value: "local", descr: "Local (per browser)"}
    ];
Severity: Minor
Found in gitweb/static/js/adjust-timezone.js - 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

Function p4BranchesInGit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def p4BranchesInGit(branchesAreInRemotes=True):
    """Find all the branches whose names start with "p4/", looking
       in remotes or heads as specified by the argument.  Return
       a dictionary of { branch: revision } for each one found.
       The branch names are the short names, without any
Severity: Minor
Found in git-p4.py - 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

Method Proxy.Run has 5 return statements (exceeds 4 allowed).
Open

func (p *Proxy) Run() error {
    hl, err := net.Listen("tcp", "127.0.0.1:0")
    if err != nil {
        return fmt.Errorf("http listen failed: %v", err)
    }
Severity: Major
Found in contrib/persistent-https/proxy.go - About 35 mins to fix

    Function lastP4Changelist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def lastP4Changelist(self):
            """Get back the last changelist number submitted in this client spec.
    
               This then gets used to patch up the username in the change. If the
               same client spec is being used by multiple processes then this might
    Severity: Minor
    Found in git-p4.py - 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

    Function p4_describe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def p4_describe(change, shelved=False):
        """Make sure it returns a valid result by checking for the presence of
           field "time".
    
           Return a dict of the results.
    Severity: Minor
    Found in git-p4.py - 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

    Method Socket.checkPermissions has 5 return statements (exceeds 4 allowed).
    Open

    func (s Socket) checkPermissions() error {
        fi, err := os.Stat(s.Dir)
        if err != nil {
            return err
        }
    Severity: Major
    Found in contrib/persistent-https/socket.go - About 35 mins to fix

      Function formatTimezoneInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function formatTimezoneInfo(hours, minutes, sep) {
          minutes = minutes || 0; // to be able to use formatTimezoneInfo(hh)
          sep = sep || ''; // default format is +/-ZZZZ
      
          if (minutes < 0 || minutes > 59) {
      Severity: Minor
      Found in gitweb/static/js/lib/datetime.js - 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

      Function addChangeTZ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function addChangeTZ(tzSelected, tzCookieInfo, tzClassName) {
          // make link to timezone UI discoverable
          addCssRule('.'+tzClassName + ':hover',
                     'text-decoration: underline; cursor: help;');
      
      
      Severity: Minor
      Found in gitweb/static/js/adjust-timezone.js - 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

      Function streamTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def streamTag(self, gitStream, labelName, labelDetails, commit, epoch):
              """Stream a p4 tag.
      
                 Commit is either a git commit, or a fast-import mark, ":<p4commit>".
                 """
      Severity: Minor
      Found in git-p4.py - 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

      Avoid too many return statements within this function.
      Open

              return;
      Severity: Major
      Found in gitweb/static/js/blame_incremental.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return False
        Severity: Major
        Found in git-p4.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return submitted
          Severity: Major
          Found in git-p4.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return;
            Severity: Major
            Found in gitweb/static/js/blame_incremental.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return False
              Severity: Major
              Found in git-p4.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return null;
                Severity: Major
                Found in gitweb/static/js/lib/common-lib.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return escaped_bytes
                  Severity: Major
                  Found in git-p4.py - About 30 mins to fix

                    Function findColorNo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function findColorNo(tr_prev, tr_next) {
                        var color_prev = getColorNo(tr_prev);
                        var color_next = getColorNo(tr_next);
                    
                    
                    
                    Severity: Minor
                    Found in gitweb/static/js/blame_incremental.js - 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

                    Function p4_keywords_regexp_for_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def p4_keywords_regexp_for_type(base, type_mods):
                        """Given a type base and modifier, return a regexp matching the keywords
                           that can be expanded in the file.
                           """
                    
                    
                    Severity: Minor
                    Found in git-p4.py - 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

                    Function sync_origin_only has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def sync_origin_only(self):
                            if self.syncWithOrigin:
                                self.hasOrigin = originP4BranchesExist()
                                if self.hasOrigin:
                                    if not self.silent:
                    Severity: Minor
                    Found in git-p4.py - 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