Mithil467/mitype

View on GitHub

Showing 6 of 32 total issues

Function main has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def main(self, win):
        """Respond to user inputs.

        This is where the infinite loop is executed to continuously serve events.

Severity: Minor
Found in mitype/app.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

Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self):
        """Initialize the application class."""
        # Start the parser
        self.text, self.text_id = resolve_commandline_arguments()
        self.tokens = self.text.split()
Severity: Minor
Found in mitype/app.py - About 1 hr to fix

    Function key_printer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def key_printer(self, win, key):
            """Print required key to terminal.
    
            Args:
                win (any): Curses window object.
    Severity: Minor
    Found in mitype/app.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 get_history_records has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_history_records(number_of_records):
        """Get records from history.
    
        Defaults to -1 if argument value not provided on command line.
    
    
    Severity: Minor
    Found in mitype/history.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 resolve_commandline_arguments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_commandline_arguments():
        """Parse CLI arguments and return practice text details.
    
        Returns:
            (str, Union[str, int]): Tuple of text content and text ID.
    Severity: Minor
    Found in mitype/commandline.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 keyinput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def keyinput(win):
            """Retrieve next character of text input.
    
            Args:
                win (any): Curses window.
    Severity: Minor
    Found in mitype/app.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