]> git.lizzy.rs Git - rust.git/blobdiff - util/update_wiki.py
Fix deploy.sh III
[rust.git] / util / update_wiki.py
index 5040a28bca0aaf9834070013604c054441afef77..e8b2280cb471637ebde0b52d5aef812aab1a6975 100755 (executable)
@@ -13,7 +13,7 @@ conf_re = re.compile(r'''define_Conf! {\n([^}]*)\n}''', re.MULTILINE)
 confvar_re = re.compile(r'''/// Lint: (\w+). (.*).*\n *\("([^"]*)", (?:[^,]*), (.*) => (.*)\),''')
 
 
-def parse_path(p="src"):
+def parse_path(p="clippy_lints/src"):
     d = {}
     for f in os.listdir(p):
         if f.endswith(".rs"):
@@ -52,6 +52,11 @@ def parse_file(d, f):
                 elif line.startswith("declare_lint!"):
                     comment = False
                     deprecated = False
+                    restriction = False
+                elif line.startswith("declare_restriction_lint!"):
+                    comment = False
+                    deprecated = False
+                    restriction = True
                 elif line.startswith("declare_deprecated_lint!"):
                     comment = False
                     deprecated = True
@@ -59,13 +64,13 @@ def parse_file(d, f):
                     last_comment = []
             if not comment:
                 l = line.strip()
-                m = re.search(r"pub\s+([A-Z_]+)", l)
+                m = re.search(r"pub\s+([A-Z_][A-Z_0-9]*)", l)
 
                 if m:
                     name = m.group(1).lower()
 
                     # Intentionally either a never looping or infinite loop
-                    while not deprecated:
+                    while not deprecated and not restriction:
                         m = re.search(level_re, line)
                         if m:
                             level = m.group(0)
@@ -75,6 +80,8 @@ def parse_file(d, f):
 
                     if deprecated:
                         level = "Deprecated"
+                    elif restriction:
+                        level = "Allow"
 
                     print("found %s with level %s in %s" % (name, level, f))
                     d[name] = (level, last_comment)
@@ -162,6 +169,7 @@ def check_wiki_page(d, c, f):
 
 def main():
     (d, c) = parse_path()
+    print('Found %s lints' % len(d))
     if "-c" in sys.argv:
         check_wiki_page(d, c, "../rust-clippy.wiki/Home.md")
     else: