From 0a2fcdc4e8901f847aab1b5299140a91f1ae8dad Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 27 Apr 2021 19:16:08 +0200 Subject: [PATCH] fixes --- tools/create_luacheck.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/create_luacheck.py b/tools/create_luacheck.py index 31046a5754..1c38c33f43 100755 --- a/tools/create_luacheck.py +++ b/tools/create_luacheck.py @@ -2,17 +2,25 @@ import os import re from pathlib import Path -path = "../mods/" -pattern = re.compile(r'[a-z]') +path = "./mods/" +# pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') +pattern = re.compile(r'^(?P[^ \t\]]+)[ ]*=[ ]*\{') + pathlist = Path(path).rglob('*.lua') for path in pathlist: path_in_str = str(path) - print(path_in_str) + # print(path_in_str) + trouve = False with open(path_in_str) as f: - for line in f: - if pattern.search(line): - print(line) + for i, line in enumerate(f.readlines()): + m = pattern.match(line) + if m: + print(path_in_str, ":", i+1, ":", m.group('nomtableau').strip()) + trouve = True + break + if not trouve: + print(path_in_str, ": -") for subdir, dirs, files in os.walk(path): for file in files: