summaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorBoYanZh <bomingzh@sjtu.edu.cn>2020-10-10 04:09:26 +0800
committerBoYanZh <bomingzh@sjtu.edu.cn>2020-10-10 04:09:26 +0800
commit6f7ee46f3b18ad9be2e744a0ef66a9cb430d3065 (patch)
tree98cdb86664ba0f9f44eac26902468bf2cf6709bd /util.py
parent1230e9083f6ba75a6ef1fa2786a3207647ad113c (diff)
update: code quailty check
Diffstat (limited to 'util.py')
-rw-r--r--util.py14
1 files changed, 11 insertions, 3 deletions
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