sayak-brm/struixLang

View on GitHub

Showing 11 of 11 total issues

Function words4control has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    def words4control(self):
        ''' Provides control structures. '''
        def RUN(terp):
            ''' Provides execution of lists containing struixLang code. '''
            import types
Severity: Minor
Found in struixPrimitives.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

File struixPrimitives.py has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

##   Copyright 2016-17 Sayak Brahmachari
##
##   Licensed under the Apache License, Version 2.0 (the "License");
##   you may not use this file except in compliance with the License.
##   You may obtain a copy of the License at
Severity: Minor
Found in struixPrimitives.py - About 7 hrs to fix

    Function words4values has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def words4values(self):
            ''' Provides support for variables and constants. '''
            def VAR(terp):
                ''' Provides creation of variables. '''
                class Variable:
    Severity: Minor
    Found in struixPrimitives.py - About 2 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 words4pythonOps has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def words4pythonOps(self):
            ''' Provides interfaces to the Python backend. '''
            def REQUESTUNSAFE(terp):
                if not self.unsafeOps:
                    ans = input("Enter Y to allow potentially unsafe operations:")
    Severity: Minor
    Found in struixPrimitives.py - About 1 hr 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 makeWord has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def makeWord(code, imm=False):
            ''' Makes an executable word from list. '''
            def word(terp):
                ''' Template for a list executor. '''
                import types
    Severity: Minor
    Found in struixPrimitives.py - About 1 hr 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 words4stack has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def words4stack():
            ''' Provides Words for Stack Operations. '''
            def DUP(terp):
                ''' Duplicate Top of Stack (ToS). '''
                if len(terp.stack) < 1:
    Severity: Minor
    Found in struixPrimitives.py - About 1 hr 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 compile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def compile(self, word, errMsg = 'Unknown Word: {}'):
            ''' Compiles struixLang code to its internal representation. '''
            import types
            uword = word.upper() if isinstance(word, str) else word
            num = self.parseNumber(uword) if not isinstance(word, (types.FunctionType, types.MethodType)) else None
    Severity: Minor
    Found in struixTerp.py - About 55 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 getVal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def getVal(terp, val, lvl):
            ''' Parses and gets next value from lexer. '''
            import types
            val = terp.compile(val)
            if isinstance(val, (types.FunctionType, types.MethodType)):
    Severity: Minor
    Found in struixPrimitives.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 words4functions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def words4functions(self):
            ''' Supports creation of user-defined words. '''
            def DEF(terp):
                ''' Marks beginning of user-defined words. '''
                name = terp.lexer.nextWord()
    Severity: Minor
    Found in struixPrimitives.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 runsource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def runsource(self, source, filename="<stdin>"):
            try:
                if '\n' in source:
                    terp.run(source.splitlines()[-1])
                else: terp.run(source)
    Severity: Minor
    Found in repl.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 interpret has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def interpret(self, word):
            ''' Executes struixLang code. '''
            import types
            if not self.isCompiling() or self.immediate:
                if isinstance(word, (types.FunctionType, types.MethodType)):
    Severity: Minor
    Found in struixTerp.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