rgs1/zk_shell

View on GitHub

Showing 141 of 141 total issues

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

    def create_async(self, path, value=b"", acl=None, ephemeral=False, sequence=False, makepath=False):
Severity: Major
Found in zk_shell/xclient.py - About 50 mins to fix

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

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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2036..2040
      zk_shell/shell.py on lines 2118..2122
      zk_shell/shell.py on lines 2274..2278
      zk_shell/shell.py on lines 2446..2450
      zk_shell/shell.py on lines 2558..2562

      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

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

              if (self.path in self._tree) != self.exists:
                  error = "Path %s " % (self.path)
                  error += "doesn't exist" if self.exists else "exists"
                  raise CopyError(error)
      Severity: Minor
      Found in zk_shell/copy_util.py and 1 other location - About 50 mins to fix
      zk_shell/copy_util.py on lines 408..411

      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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2118..2122
      zk_shell/shell.py on lines 2274..2278
      zk_shell/shell.py on lines 2362..2366
      zk_shell/shell.py on lines 2446..2450
      zk_shell/shell.py on lines 2558..2562

      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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2036..2040
      zk_shell/shell.py on lines 2274..2278
      zk_shell/shell.py on lines 2362..2366
      zk_shell/shell.py on lines 2446..2450
      zk_shell/shell.py on lines 2558..2562

      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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2036..2040
      zk_shell/shell.py on lines 2118..2122
      zk_shell/shell.py on lines 2362..2366
      zk_shell/shell.py on lines 2446..2450
      zk_shell/shell.py on lines 2558..2562

      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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2036..2040
      zk_shell/shell.py on lines 2118..2122
      zk_shell/shell.py on lines 2274..2278
      zk_shell/shell.py on lines 2362..2366
      zk_shell/shell.py on lines 2558..2562

      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

      Identical blocks of code found in 6 locations. Consider refactoring.
      Open

              try:
                  Keys.validate(params.keys)
              except Keys.Bad as ex:
                  self.show_output(str(ex))
                  return
      Severity: Major
      Found in zk_shell/shell.py and 5 other locations - About 50 mins to fix
      zk_shell/shell.py on lines 2036..2040
      zk_shell/shell.py on lines 2118..2122
      zk_shell/shell.py on lines 2274..2278
      zk_shell/shell.py on lines 2362..2366
      zk_shell/shell.py on lines 2446..2450

      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

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

              if os.path.exists(self.path) is not self.exists:
                  error = "Path %s " % (self.path)
                  error += "doesn't exist" if self.exists else "exists"
                  raise CopyError(error)
      Severity: Minor
      Found in zk_shell/copy_util.py and 1 other location - About 50 mins to fix
      zk_shell/copy_util.py on lines 504..507

      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

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

          @connected
          @ensure_params(
              Required("path"),
              Required("keys"),
              Required("value"),
      Severity: Minor
      Found in zk_shell/shell.py and 1 other location - About 50 mins to fix
      zk_shell/shell.py on lines 2069..2077

      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

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

          @connected
          @ensure_params(
              Required("path"),
              Required("keys"),
              Required("value"),
      Severity: Minor
      Found in zk_shell/shell.py and 1 other location - About 50 mins to fix
      zk_shell/shell.py on lines 2229..2237

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

          def do_tree(self, path, max_depth, level, full_path, include_stat):
      Severity: Minor
      Found in zk_shell/xclient.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if mirror and child in dst_children:
                                    dst_children.remove(child)
                                if max_items > 0 and i == max_items:
        Severity: Major
        Found in zk_shell/copy_util.py - About 45 mins to fix

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

          def to_type(value, ptype):
              """ Convert value to ptype """
              if ptype == 'str':
                  return str(value)
              elif ptype == 'int':
          Severity: Minor
          Found in zk_shell/keys.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_json_append has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_json_append(self, params):
                  """
          \x1b[1mNAME\x1b[0m
                  json_append - append an element to a list
          
          
          Severity: Minor
          Found in zk_shell/shell.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 fetch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def fetch(cls, obj, keys):
                  """
                  fetches the value corresponding to keys from obj
                  """
                  current = obj
          Severity: Minor
          Found in zk_shell/keys.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

          Avoid deeply nested control flow statements.
          Open

                                  if max_items > 0 and i == max_items:
                                      break
                                  self.set_url(os.path.join(src_url, child))
          Severity: Major
          Found in zk_shell/copy_util.py - About 45 mins to fix

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

                @ensure_params(
                    Required("path"),
                    Required("value"),
                    LabeledBooleanOptional("ephemeral"),
                    LabeledBooleanOptional("sequence"),
            Severity: Minor
            Found in zk_shell/shell.py and 1 other location - About 40 mins to fix
            zk_shell/shell.py on lines 2314..2320

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

            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

                @ensure_params(
                    Required("path"),
                    Required("keys"),
                    Required("value"),
                    Required("value_type"),
            Severity: Minor
            Found in zk_shell/shell.py and 1 other location - About 40 mins to fix
            zk_shell/shell.py on lines 1181..1187

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

            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