Showing 115 of 115 total issues

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

def read_pipe(c, ignore_error=False, raw=False, *k, **kw):
Severity: Minor
Found in git-p4.py - About 35 mins to fix

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

        def commit(self, details, files, branch, parent="", allow_empty=False):
    Severity: Minor
    Found in git-p4.py - About 35 mins to fix

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

          def streamTag(self, gitStream, labelName, labelDetails, commit, epoch):
      Severity: Minor
      Found in git-p4.py - About 35 mins to fix

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

        function fixLinks() {
            var allLinks = document.getElementsByTagName("a") || document.links;
            for (var i = 0, len = allLinks.length; i < len; i++) {
                var link = allLinks[i];
                if (!jsExceptionsRe.test(link)) {
        Severity: Minor
        Found in gitweb/static/js/javascript-detection.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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          if 'shelved_cl' in f:
                              # Handle shelved CLs using the "p4 print file@=N" syntax to print
                              # the contents
                              fileArg = f['path'] + encode_text_stream('@={}'.format(f['shelved_cl']))
          Severity: Minor
          Found in git-p4.py and 1 other location - About 35 mins to fix
          git-p4.py on lines 3331..3336

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (s Socket) Dial() (net.Conn, error) {
                network, addr := "unix", s.Path()
                if err := s.checkPermissions(); err != nil {
                    return nil, &net.OpError{Op: "dial", Net: network, Addr: &net.UnixAddr{Name: addr, Net: network}, Err: err}
                }
            Severity: Minor
            Found in contrib/persistent-https/socket.go and 1 other location - About 30 mins to fix
            contrib/persistent-https/socket.go on lines 47..53

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (s Socket) Listen() (net.Listener, error) {
                network, addr := "unix", s.Path()
                if err := s.mkdir(); err != nil {
                    return nil, &net.OpError{Op: "listen", Net: network, Addr: &net.UnixAddr{Name: addr, Net: network}, Err: err}
                }
            Severity: Minor
            Found in contrib/persistent-https/socket.go and 1 other location - About 30 mins to fix
            contrib/persistent-https/socket.go on lines 57..63

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 102.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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
                  Severity
                  Category
                  Status
                  Source
                  Language