From 6f7ee46f3b18ad9be2e744a0ef66a9cb430d3065 Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Sat, 10 Oct 2020 04:09:26 +0800 Subject: update: code quailty check --- util.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'util.py') diff --git a/util.py b/util.py index bd916df..76cb182 100644 --- a/util.py +++ b/util.py @@ -1,6 +1,7 @@ import logging import re + class Logger(): _instance = None @@ -29,9 +30,16 @@ def first(iterable, condition=lambda x: True): except StopIteration: return None + def getProjRepoName(arg): id_, name, projNum, *_ = arg eng = re.sub('[\u4e00-\u9fa5]', '', name) - eng = ''.join( - [word[0].capitalize() + word[1:] for word in eng.split()]) - return f"{eng}{id_}-p{projNum}" \ No newline at end of file + eng = ''.join([word[0].capitalize() + word[1:] for word in eng.split()]) + return f"{eng}{id_}-p{projNum}" + + +def passCodeQuality(path, language): + with open(path, encoding='utf-8', errors='replace') as f: + res = f.read() + if language == "matlab": + return "global " not in res \ No newline at end of file -- cgit v1.2.3