rgs1/zk_shell

View on GitHub

Showing 141 of 141 total issues

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

    def set(cls, obj, keys, value, fill_list_value=None):
Severity: Minor
Found in zk_shell/keys.py - About 35 mins to fix

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

        def __init__(self, sid=None, ip=None, port=None, server_ip=None, server_port=None):
    Severity: Minor
    Found in zk_shell/xclient.py - About 35 mins to fix

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

          def create(self, path, value=b"", acl=None, ephemeral=False,
      Severity: Minor
      Found in zk_shell/xclient.py - About 35 mins to fix

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

            def __init__(self, parse_result, exists, asynchronous, verbose):
        Severity: Minor
        Found in zk_shell/copy_util.py - About 35 mins to fix

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

              def copy(self, params, recursive, overwrite, max_items, mirror):
          Severity: Minor
          Found in zk_shell/shell.py - About 35 mins to fix

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

                def tree(self, path, max_depth, full_path=False, include_stat=False):
            Severity: Minor
            Found in zk_shell/xclient.py - About 35 mins to fix

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

                  def do_get(self, params):
                      """
              \x1b[1mNAME\x1b[0m
                      get - Gets the znode's value
              
              
              Severity: Minor
              Found in zk_shell/shell.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 pretty_bytes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def pretty_bytes(num):
                  """ pretty print the given number of bytes """
                  for unit in ['', 'KB', 'MB', 'GB']:
                      if num < 1024.0:
                          if unit == '':
              Severity: Minor
              Found in zk_shell/util.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 do_json_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def do_json_set(self, params):
                      """
              \x1b[1mNAME\x1b[0m
                      json_set - Sets the value for the given (possibly nested) key on a JSON object serialized in the given path
              
              
              Severity: Minor
              Found in zk_shell/shell.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 _init_zk_client has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _init_zk_client(self, hosts_list):
                      """
                      Initialize the zookeeper client (based on the provided list of hosts.
              
                      In the basic case, hostsp is a list of hosts like:
              Severity: Minor
              Found in zk_shell/shell.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 5 locations. Consider refactoring.
              Open

                  def complete_get(self, cmd_param_text, full_cmd, *rest):
                      completers = [self._complete_path, complete_labeled_boolean("watch")]
                      return complete(completers, cmd_param_text, full_cmd, *rest)
              Severity: Major
              Found in zk_shell/shell.py and 4 other locations - About 35 mins to fix
              zk_shell/shell.py on lines 460..462
              zk_shell/shell.py on lines 1850..1852
              zk_shell/shell.py on lines 1942..1944
              zk_shell/shell.py on lines 2004..2006

              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

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

                  def complete_child_watch(self, cmd_param_text, full_cmd, *rest):
                      completers = [self._complete_path, complete_labeled_boolean("verbose")]
                      return complete(completers, cmd_param_text, full_cmd, *rest)
              Severity: Major
              Found in zk_shell/shell.py and 4 other locations - About 35 mins to fix
              zk_shell/shell.py on lines 460..462
              zk_shell/shell.py on lines 1098..1100
              zk_shell/shell.py on lines 1942..1944
              zk_shell/shell.py on lines 2004..2006

              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

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

                  def complete_json_valid(self, cmd_param_text, full_cmd, *rest):
                      completers = [self._complete_path, complete_labeled_boolean("recursive")]
                      return complete(completers, cmd_param_text, full_cmd, *rest)
              Severity: Major
              Found in zk_shell/shell.py and 4 other locations - About 35 mins to fix
              zk_shell/shell.py on lines 460..462
              zk_shell/shell.py on lines 1098..1100
              zk_shell/shell.py on lines 1850..1852
              zk_shell/shell.py on lines 2004..2006

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

              def valid_ipv4(ip):
                  """ check if ip is a valid ipv4 """
                  match =  _valid_ipv4.match(ip)
                  if match is None:
                      return False
              Severity: Minor
              Found in zk_shell/util.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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add(self, path, debug, children):
                      """
                      Set a watch for path and (maybe) its children depending on the value
                      of children:
              
              
              Severity: Minor
              Found in zk_shell/watch_manager.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 print_path:
                              self.show_output("%s:\n%s", os.path.basename(path), value)
                          else:
                              self.show_output(value)
              Severity: Minor
              Found in zk_shell/shell.py and 1 other location - About 35 mins to fix
              zk_shell/shell.py on lines 2054..2057

              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

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

                  @property
                  def client(self):
                      """ the (hostaddr, port) of the local endpoint (or "") """
                      conn = self._connection
                      return conn._socket.getsockname() if conn else ""
              Severity: Minor
              Found in zk_shell/xclient.py and 1 other location - About 35 mins to fix
              zk_shell/xclient.py on lines 117..121

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

                  def get_acls_recursive(self, path, depth, include_ephemerals):
                      """A recursive generator wrapper for get_acls
              
                      :param path: path from which to start
                      :param depth: depth of the recursion (-1 no recursion, 0 means no limit)
              Severity: Minor
              Found in zk_shell/xclient.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 5 locations. Consider refactoring.
              Open

                  def complete_ls(self, cmd_param_text, full_cmd, *rest):
                      completers = [self._complete_path, complete_labeled_boolean("watch")]
                      return complete(completers, cmd_param_text, full_cmd, *rest)
              Severity: Major
              Found in zk_shell/shell.py and 4 other locations - About 35 mins to fix
              zk_shell/shell.py on lines 1098..1100
              zk_shell/shell.py on lines 1850..1852
              zk_shell/shell.py on lines 1942..1944
              zk_shell/shell.py on lines 2004..2006

              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

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

                      try:
                          match = re.compile(match, flags)
                      except sre_constants.error as ex:
                          print("Bad regexp: %s" % (ex))
                          return
              Severity: Minor
              Found in zk_shell/xclient.py and 1 other location - About 35 mins to fix
              zk_shell/xclient.py on lines 227..231

              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

              Severity
              Category
              Status
              Source
              Language