attic/fuse.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function process_archive has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def process_archive(self, archive, prefix=[]):
        """Build fuse inode hierarchy from archive metadata
        """
        unpacker = msgpack.Unpacker()
        for key, chunk in zip(archive.metadata[b'items'], self.repository.get_many(archive.metadata[b'items'])):
Severity: Minor
Found in attic/fuse.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

Avoid deeply nested control flow statements.
Open

                        if segment:
                            self.contents[parent][segment] = inode
                    elif segment in self.contents[parent]:
Severity: Major
Found in attic/fuse.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if b'source' in item and stat.S_ISREG(item[b'mode']):
                                inode = self._find_inode(item[b'source'], prefix)
                                item = self.cache.get(inode)
                                item[b'nlink'] = item.get(b'nlink', 1) + 1
                                self.items[inode] = item
    Severity: Major
    Found in attic/fuse.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if segment:
                                  self.contents[parent][segment] = inode
                              parent = inode
      Severity: Major
      Found in attic/fuse.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status