forked from MirrorHub/synapse
Report the v1 and v2 patterns separately
This commit is contained in:
parent
b052621f67
commit
77c7ed0e93
1 changed files with 12 additions and 4 deletions
|
@ -6,8 +6,13 @@ import os
|
|||
import sys
|
||||
import yaml
|
||||
|
||||
PATTERNS = []
|
||||
PATTERNS_V1 = []
|
||||
PATTERNS_V2 = []
|
||||
|
||||
RESULT = {
|
||||
"v1": PATTERNS_V1,
|
||||
"v2": PATTERNS_V2,
|
||||
}
|
||||
|
||||
class CallVisitor(ast.NodeVisitor):
|
||||
def visit_Call(self, node):
|
||||
|
@ -16,10 +21,11 @@ class CallVisitor(ast.NodeVisitor):
|
|||
else:
|
||||
return
|
||||
|
||||
|
||||
if name == "client_path_patterns":
|
||||
PATTERNS.append(node.args[0].s)
|
||||
PATTERNS_V1.append(node.args[0].s)
|
||||
elif name == "client_v2_patterns":
|
||||
PATTERNS.append(node.args[0].s)
|
||||
PATTERNS_V2.append(node.args[0].s)
|
||||
|
||||
|
||||
def find_patterns_in_code(input_code):
|
||||
|
@ -50,5 +56,7 @@ for directory in args.directories:
|
|||
filepath = os.path.join(root, filename)
|
||||
find_patterns_in_file(filepath)
|
||||
|
||||
PATTERNS_V1.sort()
|
||||
PATTERNS_V2.sort()
|
||||
|
||||
yaml.dump(sorted(PATTERNS), sys.stdout, default_flow_style=False)
|
||||
yaml.dump(RESULT, sys.stdout, default_flow_style=False)
|
||||
|
|
Loading…
Reference in a new issue