Showing 159 of 159 total issues

Avoid too many return statements within this function.
Open

            return
Severity: Major
Found in attic/archiver.py - About 30 mins to fix

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

    @memoize
    def gid2group(gid, default=None):
        try:
            return grp.getgrgid(gid).gr_name
        except KeyError:
    Severity: Minor
    Found in attic/helpers.py and 1 other location - About 30 mins to fix
    attic/helpers.py on lines 359..364

    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

    Avoid too many return statements within this function.
    Open

        return {"version": tag, "full": full}
    Severity: Major
    Found in attic/_version.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return {"version": tag, "full": full}
      Severity: Major
      Found in versioneer.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return {}
        Severity: Major
        Found in attic/_version.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return
          Severity: Major
          Found in attic/archiver.py - About 30 mins to fix

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

                    self.assert_raises(Cache.RepositoryAccessAborted, lambda :self.attic('create', self.repository_location + '_encrypted::test.2', 'input'))
            Severity: Minor
            Found in attic/testsuite/archiver.py and 1 other location - About 30 mins to fix
            attic/testsuite/archiver.py on lines 211..211

            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

            Avoid too many return statements within this function.
            Open

                    return {}
            Severity: Major
            Found in versioneer.py - About 30 mins to fix

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

                  def read(self, segment, offset, id):
                      if segment == self.segment and self._write_fd:
                          self._write_fd.flush()
                      fd = self.get_fd(segment)
                      fd.seek(offset)
              Severity: Minor
              Found in attic/repository.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 do_mount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def do_mount(self, args):
                      """Mount archive or an entire repository as a FUSE fileystem"""
                      try:
                          from attic.fuse import AtticOperations
                      except ImportError:
              Severity: Minor
              Found in attic/archiver.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 write_index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def write_index(self):
                      hints = {b'version': 1,
                               b'segments': self.segments,
                               b'compact': list(self.compact)}
                      transaction_id = self.io.get_segments_transaction_id()
              Severity: Minor
              Found in attic/repository.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 detect_openssl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def detect_openssl(prefixes):
                  for prefix in prefixes:
                      filename = os.path.join(prefix, 'include', 'openssl', 'evp.h')
                      if os.path.exists(filename):
                          with open(filename, 'r') as fd:
              Severity: Minor
              Found in setup.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 get_tests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_tests(suite):
                  """Generates a sequence of tests from a test suite
                  """
                  for item in suite:
                      try:
              Severity: Minor
              Found in attic/testsuite/__init__.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 recover_segment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def recover_segment(self, segment, filename):
                      self.fds.pop(segment).close()
                      # FIXME: save a copy of the original file
                      with open(filename, 'rb') as fd:
                          data = memoryview(fd.read())
              Severity: Minor
              Found in attic/repository.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create(cls, repository, args):
                      filename = args.repository.to_key_filename()
                      path = filename
                      i = 1
                      while os.path.exists(path):
              Severity: Minor
              Found in attic/key.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 _generic_test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _generic_test(self, cls, make_value, sha):
                      idx = cls()
                      self.assert_equal(len(idx), 0)
                      # Test set
                      for x in range(100):
              Severity: Minor
              Found in attic/testsuite/hashindex.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 print_verbose has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def print_verbose(self, msg, *args, **kw):
                      if self.verbose:
                          msg = args and msg % args or msg
                          if kw.get('newline', True):
                              print(msg)
              Severity: Minor
              Found in attic/archiver.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 attic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def attic(self, *args, **kw):
                      exit_code = kw.get('exit_code', 0)
                      fork = kw.get('fork', False)
                      if fork:
                          try:
              Severity: Minor
              Found in attic/testsuite/archiver.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 versions_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def versions_from_file(filename):
                  versions = {}
                  try:
                      f = open(filename)
                  except EnvironmentError:
              Severity: Minor
              Found in versioneer.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