wglass/zoonado

View on GitHub

Showing 47 of 49 total issues

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

    @gen.coroutine
    def remove(self, new_item):
        new_set = self.full_set.copy().remove(new_item)
        yield self.update_set(new_set)
Severity: Major
Found in zoonado/recipes/allocator.py and 1 other location - About 1 hr to fix
zoonado/recipes/allocator.py on lines 83..86

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

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

    @gen.coroutine
    def add(self, new_item):
        new_set = self.full_set.copy().add(new_item)
        yield self.update_set(new_set)
Severity: Major
Found in zoonado/recipes/allocator.py and 1 other location - About 1 hr to fix
zoonado/recipes/allocator.py on lines 88..91

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

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 repair_loop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def repair_loop(self):
        while not self.closing:
            yield self.state.wait_for(States.SUSPENDED, States.LOST)
            if self.closing:
                break
Severity: Minor
Found in zoonado/session.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in zoonado/client.py - About 1 hr to fix

    Function ensure_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def ensure_path(self, path, acl=None):
            acl = acl or self.default_acl
    
            paths_to_make = []
            for segment in path[1:].split("/"):
    Severity: Minor
    Found in zoonado/client.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

    Function leave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def leave(self, timeout=None):
            log.debug("Leaving double barrier %s", self.base_path)
            time_limit = None
            if timeout is not None:
                time_limit = time.time() + timeout
    Severity: Minor
    Found in zoonado/recipes/double_barrier.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

    Function event_dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def event_dispatch(self, event):
            log.debug("Got watch event: %s", event)
    
            if event.type:
                key = (event.type, event.path)
    Severity: Minor
    Found in zoonado/session.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

    Function make has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def make(
    Severity: Major
    Found in zoonado/protocol/acl.py - About 50 mins to fix

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

          def check_version(self, path, version):
              path = self.client.normalize_path(path)
      
              self.request.add(
                  protocol.CheckVersionRequest(path=path, version=version)
      Severity: Minor
      Found in zoonado/transaction.py and 1 other location - About 50 mins to fix
      zoonado/transaction.py on lines 48..52

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

      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 delete(self, path, version=-1):
              path = self.client.normalize_path(path)
      
              self.request.add(
                  protocol.DeleteRequest(path=path, version=version)
      Severity: Minor
      Found in zoonado/transaction.py and 1 other location - About 50 mins to fix
      zoonado/transaction.py on lines 14..18

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

      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 create has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create(
      Severity: Minor
      Found in zoonado/client.py - About 45 mins to fix

        Function create has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create(
        Severity: Minor
        Found in zoonado/transaction.py - About 45 mins to fix

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

          class SetDataRequest(Request):
              """
              """
              opcode = 5
          
          
          Severity: Minor
          Found in zoonado/protocol/data.py and 1 other location - About 45 mins to fix
          zoonado/protocol/auth.py on lines 11..20

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

          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

          class AuthRequest(Request):
              """
              """
              opcode = 100
              special_xid = AUTH_XID
          Severity: Minor
          Found in zoonado/protocol/auth.py and 1 other location - About 45 mins to fix
          zoonado/protocol/data.py on lines 31..41

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

          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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, path, defaults, client, data_watcher, child_watcher):
          Severity: Minor
          Found in zoonado/recipes/tree_cache.py - About 35 mins to fix

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

            def worker(number, client, znode_path, allocation_fn, items):
            Severity: Minor
            Found in examples/allocator.py - About 35 mins to fix

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

                  def set_perms(self, read, write, create, delete, admin):
              Severity: Minor
              Found in zoonado/protocol/acl.py - About 35 mins to fix

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

                    def gather_installed_classes(self):
                        for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT):
                            try:
                                recipe_class = entry_point.load()
                            except ImportError as e:
                Severity: Minor
                Found in zoonado/recipes/proxy.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def send(self, request, xid=None):
                        f = concurrent.Future()
                
                        if self.closing:
                            f.set_exception(exc.ConnectError(self.host, self.port))
                Severity: Minor
                Found in zoonado/connection.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 set_existing_watches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_existing_watches(self):
                        if not self.watch_callbacks:
                            return
                
                        request = protocol.SetWatchesRequest(
                Severity: Minor
                Found in zoonado/session.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

                Severity
                Category
                Status
                Source
                Language