File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 53
53
# Validate that the module is a parseable stub.
54
54
total += 1
55
55
try :
56
- astroid .parse (stub_contents )
56
+ tree = astroid .parse (stub_contents )
57
+ for i in tree .body :
58
+ print (i .__dict__ ['name' ])
59
+ for j in i .body :
60
+ if isinstance (j , astroid .scoped_nodes .FunctionDef ):
61
+ a = ''
62
+ if None in j .args .__dict__ ['annotations' ]:
63
+ a += f"Missing parameter type: { j .__dict__ ['name' ]} on line { j .__dict__ ['lineno' ]} \n "
64
+ if j .returns :
65
+ if 'Any' in j .returns .__dict__ .values ():
66
+ a += f"Missing return type: { j .__dict__ ['name' ]} on line { j .__dict__ ['lineno' ]} "
67
+ if a :
68
+ raise TypeError (a )
69
+ elif isinstance (j , astroid .node_classes .AnnAssign ):
70
+ if 'Any' == j .__dict__ ['annotation' ].__dict__ ['name' ]:
71
+ raise TypeError (f"missing attribute type on line { j .__dict__ ['lineno' ]} " )
72
+
57
73
ok += 1
58
74
except astroid .exceptions .AstroidSyntaxError as e :
59
75
e = e .__cause__
60
76
traceback .print_exception (type (e ), e , e .__traceback__ )
61
- print ()
77
+ except TypeError as err :
78
+ print (err )
62
79
63
80
print (f"{ ok } ok out of { total } " )
64
81
You can’t perform that action at this time.
0 commit comments