202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
-
+
|
"\n errors: \n" + sListErr)
nError += 1
if nError:
print("Unexpected errors:", nError)
# untested rules
i = 0
for _, sOpt, sLineId, sRuleId in gc_engine.listRules():
if sOpt != "@@@@" and sRuleId not in self._aTestedRules and not re.search("^[0-9]+[sp]$|^[pd]_", sRuleId):
if sOpt != "@@@@" and sRuleId.rstrip("0123456789") not in self._aTestedRules and not re.search("^[0-9]+[sp]$|^[pd]_", sRuleId):
echo(f"# untested rule: {sLineId}/{sRuleId}")
i += 1
if i:
echo(" [{} untested rules]".format(i))
def _splitTestLine (self, sLine):
sText, sSugg = sLine.split("->>")
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
-
+
|
sRes = " " * len(sLine)
sListErr = ""
lAllSugg = []
for dErr in aErrs:
sRes = sRes[:dErr["nStart"]] + "~" * (dErr["nEnd"] - dErr["nStart"]) + sRes[dErr["nEnd"]:]
sListErr += " * {sLineId} / {sRuleId} at {nStart}:{nEnd}\n".format(**dErr)
lAllSugg.append("|".join(dErr["aSuggestions"]))
self._aTestedRules.add(dErr["sRuleId"])
self._aTestedRules.add(dErr["sRuleId"].rstrip("0123456789"))
# test messages
if "<start>" in dErr["sMessage"] or "<end>" in dErr["sMessage"]:
print("\n# Line num : " + dErr["sLineId"] + \
"\n rule name: " + dErr["sRuleId"] + \
"\n message : " + dErr["sMessage"])
return sRes, sListErr, "|||".join(lAllSugg)
|