MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeText-parser / check_function

Function check_function

src/codetext/clean/noise_removal.py:734–759  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

732# =================== End checking ======================
733
734def 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
762def check_docstring(docstring: str, loosen_filter: bool = False):

Callers

nothing calls this directly

Calls 3

check_is_node_errorFunction · 0.85
check_is_black_nodeFunction · 0.85
check_is_empty_functionFunction · 0.85

Tested by

no test coverage detected