TIFA

TIFA is a powerful tool, but not one that comes with much configuration.

Imported as:

from pedal.tifa import tifa_analysis
tifa_analysis()

Runs the TIFA analysis engine on the current submission. Any issues identified will be attached to the report; most of them are displayed by default.

The following section breaks down the existing set of TIFA issues.

Feedback Function: Action after Return
  • Label: action_after_return
  • Justification: TIFA visited a node not in the top scope when its *return variable was definitely set in this scope.
  • Response: You performed an action after already returning from a function, on line {location.line:line}. You can only return on a path once.
Feedback Function: Return outside Function
  • Label: return_outside_function
  • Justification: TIFA visited a return node at the top level.
  • Response: You attempted to return outside of a function on line {location.line:line}. But you can only return from within a function.
Feedback Function: Multiple Return Types
  • Label: multiple_return_types
  • Justification: TIFA visited a function definition with multiple returns that unequal types.
  • Response: Your function returned {actual} on line {location.line:line}, even though you defined it to return {expected}. Your function should return values consistently.
Feedback Function: Write Out of Scope
  • Label: write_out_of_scope
  • Justification: TIFA stored to an existing variable not in this scope
  • Response: You attempted to write the variable {name_message} from a higher scope (outside the function) on line {location.line:line}. You should only use variables inside the function they were declared in.
Feedback Function: Unconnected Blocks
  • Label: unconnected_blocks
  • Justification: TIFA found a name equal to ___
  • Response: It looks like you have unconnected blocks on line {location.line:line}. Before you run your program, you must make sure that all of your blocks are connected that there are no unfilled holes.
Feedback Function: Iteration Problem
  • Label: iteration_problem
  • Justification: TIFA visited a loop where the iteration list and target were the same.
  • Response: The variable {name_message} was iterated on line {location.line:line} but you used the same variable as the iteration variable. You should choose a different variable name for the iteration variable. Usually, the iteration variable is the singular form of the iteration list (e.g., `for a_dog in dogs:`).
Feedback Function: Initialization Problem
  • Label: initialization_problem
  • Justification: TIFA read a variable that did not exist or was not previously set in this branch.
  • Response: The variable {name_message} was used on line {location.line:line}, but it was not given a value on a previous line. You cannot use a variable until it has been given a value.
Feedback Function: Possible Initialization Problem
  • Label: possible_initialization_problem
  • Justification: TIFA read a variable that was maybe set but not definitely set in this branch.
  • Response: The variable {name_message} was used on line {location.line:line}, but it was possibly not given a value on a previous line. You cannot use a variable until it has been given a value. Check to make sure that this variable was declared in all of the branches of your decision.
Feedback Function: Unused Variable
  • Label: unused_variable
  • Justification: TIFA stored a variable but it was not read any other time in the program.
  • Response: The {kind} {name_message} was {initialization} on line {location.line:line}, but was never used after that.
Feedback Function: Overwritten Variable
  • Label: overwritten_variable
  • Justification: TIFA attempted to store to a variable that was previously stored but not read.
  • Response: The variable {name_message} was given a value, but {name_message} was changed on line {location.line:line} before it was used. One of the times that you gave {name_message} a value was incorrect.
Feedback Function: Iterating over Non-list
  • Label: iterating_over_non_list
  • Justification: TIFA visited a loop’s iteration list whose type wasnot indexable.
  • Response: The {iter} is not a list, but you used it in the iteration on line {location.line:line}. You should only iterate over sequences like lists.
Feedback Function: Iterating over empty list
  • Label: iterating_over_empty_list
  • Justification: TIFA visited a loop’s iteration list that was empty.
  • Response: The {iter} was set as an empty list, and then you attempted to use it in an iteration on line {location.line:line}. You should only iterate over non-empty lists.
Feedback Function: Incompatible types
  • Label: incompatible_types
  • Justification: TIFA visited an operation with operands of the wrong type.
  • Response: You used {op_name} operation with {left_name} and {right_name} on line {location.line:line}. But you can’t do that with that operator. Make sure both sides of the operator are the right type.
Feedback Function: Parameter Type Mismatch
  • Label: parameter_type_mismatch
  • Justification: TIFA visited a function definition where a parameter type and argument type were not equal.
  • Response: You defined the parameter {parameter_name_message} as {parameter_type_name}. However, the argument passed to that parameter on line {location.line:line} was {argument_type_name}. The formal parameter type must match the argument’s type.
Feedback Function: Read out of Scope
  • Label: read_out_of_scope
  • Justification: TIFA read a variable that did not exist in this scope but existed in another.
  • Response: You attempted to read the variable {name_message} from a different scope on line {location.line:line}. You should only use variables inside the function they were declared in.
Feedback Function: Type Changes
  • Label: type_changes
  • Muted by default
  • Response: The variable {name_message} changed type from {old} to {new} on line {location.line:line}.
Feedback Function: Unnecessary Second Branch
  • Label: unnecessary_second_branch
  • Justification: There is an else or if statement who’s body is just pass.
  • Response: You have an `if` statement where one of the two branches only has `pass` in its body, on line {location.line:line}. You shouldn’t need an empty body.
Feedback Function: Else on Loop Body
  • Label: else_on_loop_body
  • Response: TODO
Feedback Function: Recursive Call
  • Label: recursive_call
  • Muted by default
  • Response: TODO
Feedback Function: Not a Function
  • Label: not_a_function
  • Response: You attempted to call {name} as if it was a function on line {location.line:line}. However, that expression was actually {singular_name}.
Feedback Function: Incorrect Arity
  • Label: incorrect_arity
  • Response: The {function_type} {function_name_message} was given the wrong number of arguments. You should have had {expected_count} arguments, but instead you had {actual_count} arguments.
Feedback Function: Multiple Return Types
  • Label: multiple_return_types
  • Justification: TIFA visited a function definition with multiple returns that unequal types.
  • Response: Your function returned {actual} on line {location.line:line}, even though you defined it to return {expected}. Your function should return values consistently.
Feedback Function: Module Not Found
  • Label: module_not_found
  • Muted by default
  • Response: TODO
Feedback Function: Append to non-list
  • Label: append_to_non_list
  • Muted by default
  • Response: TODO