Check function if - is built-in function (python) - is constructor - is empty - is error node - have length < 3 lines Args: node (tree_sitter.Node): function node exclude_list (List): exclude name of function Return:
(node, node_metadata: Dict[str, Any], exclude_list: List = None, is_class=False)
| 732 | # =================== End checking ====================== |
| 733 | |
| 734 | def check_function(node, node_metadata: Dict[str, Any], exclude_list: List = None, is_class=False): |
| 735 | """ |
| 736 | Check function if |
| 737 | - is built-in function (python) |
| 738 | - is constructor |
| 739 | - is empty |
| 740 | - is error node |
| 741 | - have length < 3 lines |
| 742 | |
| 743 | Args: |
| 744 | node (tree_sitter.Node): function node |
| 745 | exclude_list (List): exclude name of function |
| 746 | Return: |
| 747 | bool: pass the check or not |
| 748 | """ |
| 749 | node_identifier = node_metadata['identifier'] |
| 750 | |
| 751 | # Check node/code |
| 752 | if check_is_node_error(node): |
| 753 | return False |
| 754 | if check_is_black_node(node_identifier, exclude_list): |
| 755 | return False |
| 756 | if check_is_empty_function(node): |
| 757 | return False |
| 758 | |
| 759 | return True |
| 760 | |
| 761 | |
| 762 | def check_docstring(docstring: str, loosen_filter: bool = False): |
nothing calls this directly
no test coverage detected