pxt-core
Version:
Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors
323 lines (322 loc) • 9.96 kB
JSON
{
"validatorPlans": [
{
".desc": "Two different kinds of loops used",
"name": "two_different_loops",
"threshold": 2,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "controls_repeat_ext",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_while",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "pxt_controls_for",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "pxt_controls_for_of",
"count": 1
}
]
}
]
},
{
".desc": "A comment exists in a project",
"name": "comment_used",
"threshold": 1,
"checks": [
{
"validator": "commentsExist",
"count": 1
}
]
},
{
".desc": "A block comment exists in a project",
"name": "block_comment_used",
"threshold": 1,
"checks": [
{
"validator": "blockCommentsExist",
"count": 1
}
]
},
{
".desc": "All function definitions have block comments",
"name": "functions_have_comments",
"threshold": 1,
"checks": [
{
"validator": "specificBlockCommentsExist",
"blockType": "function_definition"
}
]
},
{
".desc": "A custom function exists and gets called",
"name": "custom_function_called",
"threshold": 2,
"checks": [
{
"validator": "blocksInSetExist",
"blocks": ["function_call", "function_call_output"],
"count": 1
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "function_definition",
"count": 1
}
]
}
]
},
{
".desc": "A parameter's value is used",
"name": "parameter_variable_accessed",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_string",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_number",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_boolean",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_array",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_custom",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "variables_get_reporter",
"count": 1
}
]
}
]
},
{
".desc": "A numeric parameter's value is used",
"name": "numeric_parameter_variable_accessed",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "argument_reporter_number",
"count": 1
}
]
}
]
},
{
".desc": "A custom variable's value is set to a random number",
"name": "variable_set_random",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "variables_set",
"count": 1
}
],
"childValidatorPlans": ["device_random_used"]
}
]
},
{
".desc": "Random number block used in project",
"name": "device_random_used",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_random",
"count": 1
}
]
}
]
},
{
".desc": "make sure two numbers are equal",
"name": "num_compare_eq",
"threshold": 1,
"checks": [
{
"validator": "blockFieldValueExists",
"fieldType": "OP",
"fieldValue": "EQ",
"blockType": "logic_compare",
"childValidatorPlans": ["two_nums_exist"]
}
]
},
{
".desc": "two numbers exist",
"name": "two_nums_exist",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "math_number",
"count": 2
}
]
}
]
},
{
".desc": "a number exists",
"name": "math_num_exists",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "math_number",
"count": 1
}
]
}
]
},
{
".desc": "Block used n times (to be filled in by the user)",
"name": "block_used_n_times",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "",
"count": 0
}
]
}
]
},
{
".desc": "Loops used n times (to be filled in by the user)",
"name": "n_loops",
"threshold": 1,
"checks": [
{
"validator": "blocksInSetExist",
"blocks": ["controls_repeat_ext", "device_while", "pxt_controls_for", "pxt_controls_for_of"],
"count": 0
}
]
},
{
".desc": "Variable creation & usage validation, with optional name filtering",
"name": "variable_usage",
"threshold": 1,
"checks": [
{
"validator": "variableUsage",
"count": 0,
"name": ""
}
]
},
{
".desc": "The zero number block is present.",
"name": "number_zero",
"threshold": 1,
"checks": [
{
"validator": "blockFieldValueExists",
"fieldType": "NUM",
"fieldValue": 0,
"blockType": "math_number"
}
]
},
{
".desc": "Ask Copilot a question",
"name": "ai_question",
"threshold": -1,
"checks": [
{
"validator": "aiQuestion",
"question": "",
"shareId": ""
}
]
}
]
}