@@ -20,7 +20,7 @@ predicate global_name_used(Module m, Variable name) {
2020 u .getEnclosingModule ( ) = m
2121 )
2222 or
23- /* A use of an undefined class local variable, will use the global variable */
23+ // A use of an undefined class local variable, will use the global variable
2424 exists ( Name u , LocalVariable v |
2525 u .uses ( v ) and
2626 v .getId ( ) = name .getId ( ) and
@@ -33,10 +33,10 @@ predicate global_name_used(Module m, Variable name) {
3333predicate all_not_understood ( Module m ) {
3434 exists ( GlobalVariable a |
3535 a .getId ( ) = "__all__" and a .getScope ( ) = m |
36- /* __all__ is not defined as a simple list */
36+ // ` __all__` is not defined as a simple list
3737 not m .declaredInAll ( _)
3838 or
39- /* __all__ is modified */
39+ // ` __all__` is modified
4040 exists ( Call c | c .getFunc ( ) .( Attribute ) .getObject ( ) = a .getALoad ( ) )
4141 )
4242}
@@ -45,10 +45,9 @@ predicate imported_module_used_in_doctest(Import imp) {
4545 exists ( string modname |
4646 imp .getAName ( ) .getAsname ( ) .( Name ) .getId ( ) = modname
4747 and
48- /* Look for doctests containing the patterns:
49- * >>> …name…
50- * ... …name…
51- */
48+ // Look for doctests containing the patterns:
49+ // >>> …name…
50+ // ... …name…
5251 exists ( StrConst doc |
5352 doc .getEnclosingModule ( ) = imp .getScope ( ) and
5453 doc .isDocString ( ) and
@@ -62,9 +61,8 @@ predicate imported_module_used_in_typehint(Import imp) {
6261 imp .getAName ( ) .getAsname ( ) .( Name ) .getId ( ) = modname and
6362 loc .getFile ( ) = imp .getScope ( ) .( Module ) .getFile ( )
6463 |
65- /* Look for typehints containing the patterns:
66- * # type: …name…
67- */
64+ // Look for type hints containing the patterns:
65+ // # type: …name…
6866 exists ( Comment typehint |
6967 loc = typehint .getLocation ( ) and
7068 typehint .getText ( ) .regexpMatch ( "# type:.*" + modname + ".*" )
@@ -95,27 +93,26 @@ predicate unused_import(Import imp, Variable name) {
9593 and
9694 not global_name_used ( imp .getScope ( ) , name )
9795 and
98- /* Imports in __init__.py are used to force module loading */
96+ // Imports in ` __init__.py` are used to force module loading
9997 not imp .getEnclosingModule ( ) .isPackageInit ( )
10098 and
101- /* Name may be imported for use in epytext documentation */
99+ // Name may be imported for use in epytext documentation
102100 not exists ( Comment cmt |
103101 cmt .getText ( ) .matches ( "%L{" + name .getId ( ) + "}%" ) |
104102 cmt .getLocation ( ) .getFile ( ) = imp .getLocation ( ) .getFile ( )
105103 )
106104 and
107105 not name_acceptable_for_unused_variable ( name )
108106 and
109- /* Assume that opaque `__all__` includes imported module */
107+ // Assume that opaque `__all__` includes imported module
110108 not all_not_understood ( imp .getEnclosingModule ( ) )
111109 and
112110 not imported_module_used_in_doctest ( imp )
113111 and
114112 not imported_module_used_in_typehint ( imp )
115113 and
116- /* Only consider import statements that actually point-to something (possibly an unknown module).
117- * If this is not the case, it's likely that the import statement never gets executed.
118- */
114+ // Only consider import statements that actually point-to something (possibly an unknown module).
115+ // If this is not the case, it's likely that the import statement never gets executed.
119116 imp .getAName ( ) .getValue ( ) .pointsTo ( _)
120117}
121118
0 commit comments