Commit 58511681 by sikang

update

parent deb75b02
......@@ -54,6 +54,11 @@ def get_brackets(line):
right = line.count("}")
return left - right
def is_note(line):
final_line = line.replace("://","")
return "//" in final_line or "\t*" in final_line
def process_file_content(path, file_name):
# print("processing content: %s..." % path)
with open(path, "r", encoding="utf-8") as f:
......@@ -70,7 +75,7 @@ def process_file_content(path, file_name):
#接口和抽象类 直接跳过
if "interface" in line or "abstract" in line:
isAbstract=True
if isAbstract or "//" in line or "*" in line:
if isAbstract or is_note(line):
f_w.write(line)
continue
......@@ -80,8 +85,7 @@ def process_file_content(path, file_name):
#return后有多行代码
if "return" in line or ("throw" in line and not isReturn):
isReturn = True
return_level = 0
return_level = get_brackets(line)
if isReturn:
return_level += get_brackets(line)
......@@ -113,10 +117,10 @@ def process_file_content(path, file_name):
"throw" not in line and \
"};" not in line and \
"});" not in line and \
"//" not in line:
not is_note(line):
if random.randint(0, 20) % 2 == 0:
line = line.replace(";\n", get_rand_code(func_level>0))
# if random.randint(0, 20) % 2 == 0:
line = line.replace(";\n", get_rand_code(func_level>0))
if ";" in line :
isErrorIf = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment