knipknap/exscript

View on GitHub

Showing 245 of 245 total issues

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

def netlog(message,
Severity: Minor
Found in Exscript/util/syslog.py - About 45 mins to fix

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

        def __init__(self, lexer, parser, parent):
            Token.__init__(self, 'FunctionCall', lexer, parser, parent)
            self.funcname = None
            self.arguments = []
    
    
    Severity: Minor
    Found in Exscript/interpreter/functioncall.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Minor
    Found in Exscript/util/mail.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if search_window_len > search_window_size:
                                  clean_sw_size -= search_window_size
                              break
      Severity: Major
      Found in Exscript/protocols/telnetlib.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if not self.send_data is None:
                                        self.send_data.write(data)
                                    channel.send(data.encode(self.encoding))
        Severity: Major
        Found in Exscript/protocols/protocol.py - About 45 mins to fix

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

              def acquire_account(self, account=None, owner=None):
                  """
                  Acquires the given account. If no account is given, one is chosen
                  from the default pool.
          
          
          Severity: Minor
          Found in Exscript/account.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 skip has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def skip(app, what, name, obj, skip, options):
          Severity: Minor
          Found in doc/conf.py - About 45 mins to fix

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

                def _paramiko_connect(self):
                    # Find supported address families.
                    addrinfo = socket.getaddrinfo(self.host, self.port)
                    for family, socktype, proto, canonname, sockaddr in addrinfo:
                        af = family
            Severity: Minor
            Found in Exscript/protocols/ssh2.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

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

                            if buffer.strip() != '':
                                self.add(Execute(lexer, parser, self, buffer))
                                buffer = ''
            Severity: Minor
            Found in Exscript/interpreter/template.py and 1 other location - About 45 mins to fix
            Exscript/interpreter/template.py on lines 76..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 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                        elif lexer.next_if('newline'):
                            if buffer.strip() != '':
                                self.add(Execute(lexer, parser, self, buffer))
                                buffer = ''
            Severity: Minor
            Found in Exscript/interpreter/template.py and 1 other location - About 45 mins to fix
            Exscript/interpreter/template.py on lines 54..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 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                def init_terminal(self, conn):
                    conn.execute('terminal exec prompt no-timestamp')
                    conn.execute('terminal len 0')
                    conn.execute('terminal width 0')
            Severity: Major
            Found in Exscript/protocols/drivers/ios_xr.py and 2 other locations - About 40 mins to fix
            Exscript/protocols/drivers/junos.py on lines 80..83
            Exscript/protocols/drivers/sros.py on lines 43..46

            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 3 locations. Consider refactoring.
            Open

                def init_terminal(self, conn):
                    conn.execute('environment no more')
                    conn.execute('environment reduced-prompt 2')
                    conn.execute('environment no saved-ind-prompt')
            Severity: Major
            Found in Exscript/protocols/drivers/sros.py and 2 other locations - About 40 mins to fix
            Exscript/protocols/drivers/ios_xr.py on lines 48..51
            Exscript/protocols/drivers/junos.py on lines 80..83

            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

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

                    if result == -2:
                        if self.driver_replaced:
                            self.driver_replaced = False
                            raise DriverReplacedException()
                        else:
            Severity: Minor
            Found in Exscript/protocols/telnet.py and 1 other location - About 40 mins to fix
            Exscript/protocols/dummy.py on lines 124..129

            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

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

                    if result == -2:
                        if self.driver_replaced:
                            self.driver_replaced = False
                            raise DriverReplacedException()
                        else:
            Severity: Minor
            Found in Exscript/protocols/dummy.py and 1 other location - About 40 mins to fix
            Exscript/protocols/telnet.py on lines 100..105

            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 3 locations. Consider refactoring.
            Open

                def init_terminal(self, conn):
                    conn.execute('set cli screen-length 0')
                    conn.execute('set cli screen-width 0')
                    conn.execute('set cli terminal ansi')
            Severity: Major
            Found in Exscript/protocols/drivers/junos.py and 2 other locations - About 40 mins to fix
            Exscript/protocols/drivers/ios_xr.py on lines 48..51
            Exscript/protocols/drivers/sros.py on lines 43..46

            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

                    if lexer.next_if('keyword', 'if'):
                        lexer.expect(self, 'whitespace')
                        self.expression = Expression(lexer, parser, parent)
            Severity: Minor
            Found in Exscript/interpreter/fail.py and 1 other location - About 40 mins to fix
            Exscript/interpreter/extract.py on lines 82..84

            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

                    if lexer.next_if('keyword', 'from'):
                        lexer.expect(self, 'whitespace')
                        self.source = Term(lexer, parser, parent)
            Severity: Minor
            Found in Exscript/interpreter/extract.py and 1 other location - About 40 mins to fix
            Exscript/interpreter/fail.py on lines 42..44

            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

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

                    def decorated(job, host, conn, *args, **kwargs):
            Severity: Minor
            Found in Exscript/util/decorator.py - About 35 mins to fix

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

                  def priority_enqueue(self,
              Severity: Minor
              Found in Exscript/workqueue/workqueue.py - About 35 mins to fix

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

                    def __init__(self,
                Severity: Minor
                Found in Exscript/emulators/vdevice.py - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language