zmbc/shakespearelang

View on GitHub

Showing 5 of 79 total issues

Function run_repl has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def run_repl(interpreter):
    previous_input_style = interpreter.settings.input_style
    previous_output_style = interpreter.settings.output_style
    interpreter.settings.input_style = "interactive"
    interpreter.settings.output_style = "verbose"
Severity: Minor
Found in shakespearelang/_repl.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 _run_repl_input has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _run_repl_input(interpreter, repl_input, current_character):
    ast = interpreter.parse(repl_input + "\n", "repl_input")

    event = ast.event
    sentences = ast.sentences
Severity: Minor
Found in shakespearelang/_repl.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 _preprocess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _preprocess(self, ast: AST):
        for act in ast.acts:
            act_number = act.number.value
            if act_number in self.scene_indices:
                raise ShakespeareRuntimeError(
Severity: Minor
Found in shakespearelang/_preprocess.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self, state, settings):
        state.assert_character_on_stage(self.character)

        if self.has_condition and self.condition_type_positive != state.global_boolean:
            if settings.output_style in ["verbose", "debug"]:
Severity: Minor
Found in shakespearelang/_operation.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 _run_logic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _run_logic(self, state, settings):
        if self.characters is not None:
            if settings.output_style in ["verbose", "debug"]:
                print(f"Exeunt {', '.join(self.characters)}")
            state.exeunt_characters(self.characters)
Severity: Minor
Found in shakespearelang/_operation.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