hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py

Summary

Maintainability
F
4 days
Test Coverage

Function action has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

    def action(self):
        """Return a code indicating the update status of this file.

        The possible return values are:
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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

File rcvs.py has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

"""Remote CVS -- command line interface"""

# XXX To do:
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 5 hrs to fix

    Function whichentries has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def whichentries(self, files, localfilestoo = 0):
            if files:
                list = []
                for file in files:
                    if self.entries.has_key(file):
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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 recurse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def recurse(self):
            self.close()
            names = os.listdir(os.curdir)
            for name in names:
                if name == os.curdir or name == os.pardir:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def commit(self, files, message = ""):
            list = self.whichentries(files)
            if not list: return
            ok = 1
            for e in list:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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

    Avoid deeply nested control flow statements.
    Open

                            if self.esum == self.rsum:
                                return '='
                            else:
                                return 'U'
                        elif self.esum == self.rsum:
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if self.lsum == self.rsum:
                                  return 'u'
                              else:
                                  return 'C'
                          if self.lsum == self.esum:
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 45 mins to fix

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

            def diff(self, opts = []):
                self.action()           # To update lseen, rseen
                flags = ''
                rev = self.rrev
                # XXX should support two rev options too!
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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

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

            def do_update(self, opts, files):
                """update [-l] [-R] [file] ..."""
                local = DEF_LOCAL
                for o, a in opts:
                    if o == '-l': local = 1
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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 'C'
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              else: return 'D' # Deleted remotely
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            else: return 'C' # Real conflict
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  if self.rsum: return 'R' # Removed
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    else: return 'r' # Get rid of entry
                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                              return 'C'
                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                                return 'U'
                    Severity: Major
                    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return 'M'
                      Severity: Major
                      Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                    return 'u'
                        Severity: Major
                        Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                              if self.enew: return 'A' # New locally
                          Severity: Major
                          Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                        return '='
                            Severity: Major
                            Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                      return 'U'
                              Severity: Major
                              Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                        return 'u'
                                Severity: Major
                                Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                      else: return 'r' # Get rid of entry
                                  Severity: Major
                                  Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py - About 30 mins to fix

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

                                        def update(self):
                                            code = self.action()
                                            if code == '=': return
                                            print code, self.file
                                            if code in ('U', 'N'):
                                    Severity: Minor
                                    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.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

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

                                        def do_remove(self, opts, files):
                                            """remove file ..."""
                                            if not files:
                                                print "'rcvs remove' requires at least one file"
                                                return
                                    Severity: Major
                                    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py and 1 other location - About 1 hr to fix
                                    AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py on lines 438..444

                                    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 43.

                                    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

                                        def do_add(self, opts, files):
                                            """add file ..."""
                                            if not files:
                                                print "'rcvs add' requires at least one file"
                                                return
                                    Severity: Major
                                    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py and 1 other location - About 1 hr to fix
                                    AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py on lines 446..452

                                    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 43.

                                    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 3 locations. Consider refactoring.
                                    Open

                                            for o, a in opts:
                                                flags = flags + ' ' + o + a
                                    Severity: Minor
                                    Found in AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rcvs.py and 2 other locations - About 30 mins to fix
                                    AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rrcs.py on lines 91..92
                                    AppPkg/Applications/Python/Python-2.7.2/Demo/pdist/rrcs.py on lines 101..102

                                    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 32.

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status