knipknap/exscript

View on GitHub

Showing 245 of 245 total issues

Avoid too many return statements within this function.
Open

            return [int(lft) >= int(rgt)]
Severity: Major
Found in Exscript/interpreter/expression.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return [int(lft) < int(rgt)]
    Severity: Major
    Found in Exscript/interpreter/expression.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 3
      Severity: Major
      Found in Exscript/interpreter/expression.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return [int(lft) % int(rgt)]
        Severity: Major
        Found in Exscript/interpreter/expression.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return _error_401(self, 'Incorrect realm')
          Severity: Major
          Found in Exscript/servers/httpd.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return [lft != rgt]
            Severity: Major
            Found in Exscript/interpreter/expression.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return [lft in rgt_lst]
              Severity: Major
              Found in Exscript/interpreter/expression.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return [int(lft) > int(rgt)]
                Severity: Major
                Found in Exscript/interpreter/expression.py - About 30 mins to fix

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

                          if self.irawq >= len(self.rawq):
                              self.rawq = b''
                              self.irawq = 0
                  Severity: Minor
                  Found in Exscript/protocols/telnetlib.py and 1 other location - About 30 mins to fix
                  Exscript/protocols/telnetlib.py on lines 579..581

                  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

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

                              elif lexer.next_if('string_delimiter'):
                                  break
                              else:
                                  ttype = lexer.token()[0]
                                  lexer.syntax_error('Expected string but got %s' % ttype, self)
                  Severity: Minor
                  Found in Exscript/interpreter/string.py and 1 other location - About 30 mins to fix
                  Exscript/interpreter/template.py on lines 76..82

                  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

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

                          if self.irawq >= len(self.rawq):
                              self.rawq = b''
                              self.irawq = 0
                  Severity: Minor
                  Found in Exscript/protocols/telnetlib.py and 1 other location - About 30 mins to fix
                  Exscript/protocols/telnetlib.py on lines 591..593

                  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

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

                      def _get_next(self, pop=True):
                          # We need to leave sleeping items in the queue because else we
                          # would not know their original position after they wake up.
                          # So we need to temporarily remove sleeping items from the top of
                          # the queue here.
                  Severity: Minor
                  Found in Exscript/workqueue/pipeline.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 from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def from_file(filename, password='', keytype=None):
                          """
                          Returns a new PrivateKey instance with the given attributes.
                          If keytype is None, we attempt to automatically detect the type.
                  
                  
                  Severity: Minor
                  Found in Exscript/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 _call_key_handlers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _call_key_handlers(self, key_handlers, data):
                          if key_handlers is not None:
                              for key, func in list(key_handlers.items()):
                                  if data == key:
                                      func(self)
                  Severity: Minor
                  Found in Exscript/protocols/protocol.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 check_head_for_os has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_head_for_os(self, string):
                          # By default Fortigate shows only prompt
                          if len(string.splitlines()) == 1:
                              for head_re in _fortios_re:
                                  if head_re.search(string):
                  Severity: Minor
                  Found in Exscript/protocols/drivers/fortios.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, name, filename, mode='a', delete=False):
                          Log.__init__(self, name)
                          self.filename = filename
                          self.errorname = filename + '.error'
                          self.mode = mode
                  Severity: Minor
                  Found in Exscript/logger.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 _run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _run(self, hosts, callback, queue_function, *args):
                          hosts = to_hosts(hosts, default_domain=self.domain)
                          self.total += len(hosts)
                          callback = _prepare_connection(callback)
                          task = Task(self.workqueue)
                  Severity: Minor
                  Found in Exscript/queue.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 listener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def listener(self):
                          """Helper for mt_interact() -- this executes in the other thread."""
                          while 1:
                              try:
                                  data = self.read_eager()
                  Severity: Minor
                  Found in Exscript/protocols/telnetlib.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 _first_match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _first_match(string, compiled):
                      match = compiled.search(string)
                      if match is None and compiled.groups <= 1:
                          return None
                      elif match is None:
                  Severity: Minor
                  Found in Exscript/util/match.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 _paramiko_auth_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _paramiko_auth_key(self, username, keys, password):
                          if password is None:
                              password = ''
                  
                          saved_exception = AuthenticationException(
                  Severity: Minor
                  Found in Exscript/protocols/ssh2.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