knipknap/exscript

View on GitHub

Showing 245 of 245 total issues

File protocol.py has 1036 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
Severity: Major
Found in Exscript/protocols/protocol.py - About 2 days to fix

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

    class LoggerProxy(object):
    
        """
        An object that has a 1:1 relation to a Logger object in another
        process.
    Severity: Major
    Found in Exscript/logger.py and 1 other location - About 1 day to fix
    Exscript/account.py on lines 366..397

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

    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 LoggerProxy(object):
    
        """
        An object that has a 1:1 relation to a Logger object in another
        process.
    Severity: Major
    Found in Exscript/account.py and 1 other location - About 1 day to fix
    Exscript/logger.py on lines 235..266

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

    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

    File telnetlib.py has 621 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #
    # Copyright (C) 2010-2017 Samuel Abels
    # The MIT License (MIT)
    #
    # Permission is hereby granted, free of charge, to any person obtaining
    Severity: Major
    Found in Exscript/protocols/telnetlib.py - About 1 day to fix

      File queue.py has 601 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #
      # Copyright (C) 2010-2017 Samuel Abels
      # The MIT License (MIT)
      #
      # Permission is hereby granted, free of charge, to any person obtaining
      Severity: Major
      Found in Exscript/queue.py - About 1 day to fix

        File account.py has 589 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #
        # Copyright (C) 2010-2017 Samuel Abels
        # The MIT License (MIT)
        #
        # Permission is hereby granted, free of charge, to any person obtaining
        Severity: Major
        Found in Exscript/account.py - About 1 day to fix

          Protocol has 60 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Protocol(object):
          
              """
              This is the base class for all protocols; it defines the common portions
              of the API.
          Severity: Major
          Found in Exscript/protocols/protocol.py - About 1 day to fix

            Function process_rawq has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

                def process_rawq(self):
                    """Transfer from raw queue to cooked queue.
            
                    Set self.eof when connection is closed.  Don't block unless in
                    the midst of an IAC sequence.
            Severity: Minor
            Found in Exscript/protocols/telnetlib.py - About 7 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

            Function _waitfor has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
            Open

                def _waitfor(self, relist, timeout=None, flush=False, cleanup=None):
                    re = None
                    relist = relist[:]
                    indices = list(range(len(relist)))
                    search_window_size = 150
            Severity: Minor
            Found in Exscript/protocols/telnetlib.py - About 6 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

            Function value has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                def value(self, context):
                    # Special behavior where we only have one term.
                    if self.op is None:
                        return self.lft.value(context)
                    elif self.op == 'not':
            Severity: Minor
            Found in Exscript/interpreter/expression.py - About 6 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

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

            class BigIPDriver(Driver):
            
                def __init__(self):
                    Driver.__init__(self, 'bigip')
                    self.user_re = _user_re
            Severity: Major
            Found in Exscript/protocols/drivers/bigip.py and 1 other location - About 6 hrs to fix
            Exscript/protocols/drivers/nxos.py on lines 39..56

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

            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 NXOSDriver(Driver):
            
                def __init__(self):
                    Driver.__init__(self, 'nxos')
                    self.user_re = _user_re
            Severity: Major
            Found in Exscript/protocols/drivers/nxos.py and 1 other location - About 6 hrs to fix
            Exscript/protocols/drivers/bigip.py on lines 37..54

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

            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

            File mail.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #
            # Copyright (C) 2010-2017 Samuel Abels
            # The MIT License (MIT)
            #
            # Permission is hereby granted, free of charge, to any person obtaining
            Severity: Minor
            Found in Exscript/util/mail.py - About 5 hrs to fix

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

                  def _app_authenticate(self,
                                        account,
                                        password,
                                        flush=True,
                                        bailout=False):
              Severity: Minor
              Found in Exscript/protocols/protocol.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

              File ssh2.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #
              # Copyright (C) 2010-2017 Samuel Abels
              # The MIT License (MIT)
              #
              # Permission is hereby granted, free of charge, to any person obtaining
              Severity: Minor
              Found in Exscript/protocols/ssh2.py - About 4 hrs to fix

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

                @secure_function
                def authorize(scope, password=[None]):
                    """
                    Looks for a password prompt on the current connection
                    and enters the given password.
                Severity: Major
                Found in Exscript/stdlib/connection.py and 1 other location - About 4 hrs to fix
                Exscript/stdlib/connection.py on lines 82..104

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

                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

                @secure_function
                def auto_authorize(scope, password=[None]):
                    """
                    Executes a command on the remote host that causes an authorization
                    procedure to be started, then authorizes using the given password
                Severity: Major
                Found in Exscript/stdlib/connection.py and 1 other location - About 4 hrs to fix
                Exscript/stdlib/connection.py on lines 60..79

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

                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

                File crypt.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #
                # Copyright (C) 2010-2017 Samuel Abels
                # The MIT License (MIT)
                #
                # Permission is hereby granted, free of charge, to any person obtaining
                Severity: Minor
                Found in Exscript/util/crypt.py - About 4 hrs to fix

                  Function __init__ has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, lexer, parser, parent, *args, **kwargs):
                          Scope.__init__(self, 'Template', lexer, parser, parent, **kwargs)
                          lexer.set_grammar(grammar_c)
                          # print("Opening Scope:", lexer.token())
                          buffer = ''
                  Severity: Minor
                  Found in Exscript/interpreter/template.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

                  Function _open_posix_shell has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _open_posix_shell(self,
                                            channel,
                                            key_handlers,
                                            handle_window_size):
                          # We need to make sure to use an unbuffered stdin, else multi-byte
                  Severity: Minor
                  Found in Exscript/protocols/protocol.py - About 3 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

                  Severity
                  Category
                  Status
                  Source
                  Language