Skip to content
Snippets Groups Projects
Commit a20d8561 authored by Mathieu Courtois's avatar Mathieu Courtois
Browse files

[#34298] utmess and message id must be on the same line to be checked

parent 9ecb0f41
No related branches found
No related tags found
No related merge requests found
......@@ -198,12 +198,34 @@ class ObsoleteSdj(FileContentCat, TextMsg):
apply_ctxt = CheckContext(reponame=["src"], branch="main")
search = search_msg(r"(?P<main>\w+\.sdj(?:\.\w+)?)", ignore_case=False)
class ObsoleteGetvectjev(FileContentCat, TextMsg):
"""Obsolete use of getvectjev or getcolljev"""
id = "C4015"
search = search_msg(r"(?P<main>(getvectjev|getcolljev))", ignore_case=False)
class MultiLinesUtmess(FileContentCat, GenericMsg):
"""Message id not found on the same line (use a dict for args)"""
id = "C4501"
def search(self, txt):
"""Check for UTMESS without message id"""
if "def format_exception" in txt:
return []
if "class MESSAGE_LOGGER" in txt:
return []
re_utm = re.compile(r"(?P<line>(?:UTMESS|GetText|message_exception)\s*\(.*)", re.M)
re_id = re.compile(r"(UTMESS|GetText|message_exception)\s*\(.*_", re.I)
err = []
for mat in re_utm.finditer(txt):
if not re_id.search(mat.group("line")):
err.append(f": {mat.group('line')}")
return err
class ReformatSource(FilenameCat, COMM.ReformatPy):
"""Reformat Python source"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment