From 090f10e3be90555a5a770a43566b88547191f4d1 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 18 Aug 2016 09:47:57 +0100 Subject: [PATCH 1/3] add log hints for new chktex messages --- .../HumanReadableLogsRules.coffee | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index c61c61506b..7d31bf3f43 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -102,5 +102,22 @@ define -> [ humanReadableHint: """ You have used an open bracket without a corresponding close bracket. """ - + , ruleId: "hint_mismatched_environment2" + regexToMatch: /Error: `\\end\{([^\}]+)\})' expected but found `\\end\{([^\}]+)\}'.*/ + newMessage: "Error: environment does not match \\begin{$1} ... \\end{$2}" + humanReadableHint: """ + You have used \\begin{...} without a corresponding \\end{...}. + """ + , ruleId: "hint_mismatched_environment3" + regexToMatch: /Error: No matching \\end found for `\\begin\{([^\}]+)\}'.*/ + newMessage: "Error: No matching \\end found for \\begin{$1}" + humanReadableHint: """ + You have used \\begin{...} without a corresponding \\end{...}. + """ + , ruleId: "hint_mismatched_environment3" + regexToMatch: /Error: Found `\\end\{([^\}]+)\}' without corresponding \\begin.*/ + newMessage: "Error: Found \\end{$1} without a corresponding \\begin{$1}" + humanReadableHint: """ + You have used \\begin{...} without a corresponding \\end{...}. + """ ] From 109e79db9930ba32e8a7f86a4da9483380ed8f87 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 18 Aug 2016 13:21:27 +0100 Subject: [PATCH 2/3] track cascading errors in Human Readable Log Hints --- .../human-readable-logs/HumanReadableLogs.coffee | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogs.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogs.coffee index e59e35a40c..61cc1b7df7 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogs.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogs.coffee @@ -11,6 +11,8 @@ define [ _getRule = (logMessage) -> return rule for rule in ruleset when rule.regexToMatch.test logMessage + seenErrorTypes = {} # keep track of types of errors seen + for entry in parsedLogEntries.all ruleDetails = _getRule entry.message @@ -21,8 +23,20 @@ define [ entry.ruleId = 'hint_' + ruleDetails.regexToMatch.toString().replace(/\s/g, '_').slice(1, -1) if ruleDetails.newMessage? entry.message = entry.message.replace ruleDetails.regexToMatch, ruleDetails.newMessage + # suppress any entries that are known to cascade from previous error types + if ruleDetails.cascadesFrom? + for type in ruleDetails.cascadesFrom + entry.suppressed = true if seenErrorTypes[type] + # record the types of errors seen + if ruleDetails.types? + for type in ruleDetails.types + seenErrorTypes[type] = true entry.humanReadableHint = ruleDetails.humanReadableHint if ruleDetails.humanReadableHint? entry.extraInfoURL = ruleDetails.extraInfoURL if ruleDetails.extraInfoURL? - + + # filter out the suppressed errors (from the array entries in parsedLogEntries) + for key, errors of parsedLogEntries when typeof errors is 'object' and errors.length > 0 + parsedLogEntries[key] = (err for err in errors when not err.suppressed) + return parsedLogEntries From 133250c15092be0ca8c4935a950530a299c2bb60 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 18 Aug 2016 13:28:47 +0100 Subject: [PATCH 3/3] extend log hints for more chktex errors --- .../HumanReadableLogsRules.coffee | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index 7d31bf3f43..9436d0705d 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -90,6 +90,7 @@ define -> [ """ , ruleId: "hint_mismatched_environment" + types: ['environment'] regexToMatch: /Error: `([^']{2,})' expected, found `([^']{2,})'.*/ newMessage: "Error: environment does not match \\begin{$1} ... \\end{$2}" humanReadableHint: """ @@ -97,27 +98,35 @@ define -> [ """ , ruleId: "hint_mismatched_brackets" + types: ['environment'] regexToMatch: /Error: `([^a-zA-Z0-9])' expected, found `([^a-zA-Z0-9])'.*/ newMessage: "Error: brackets do not match, found '$2' instead of '$1'" humanReadableHint: """ You have used an open bracket without a corresponding close bracket. """ - , ruleId: "hint_mismatched_environment2" - regexToMatch: /Error: `\\end\{([^\}]+)\})' expected but found `\\end\{([^\}]+)\}'.*/ - newMessage: "Error: environment does not match \\begin{$1} ... \\end{$2}" + , + ruleId: "hint_mismatched_environment2" + types: ['environment'] + regexToMatch: /Error: `\\end\{([^\}]+)\}' expected but found `\\end\{([^\}]+)\}'.*/ + newMessage: "Error: environments do not match: \\begin{$1} ... \\end{$2}" humanReadableHint: """ - You have used \\begin{...} without a corresponding \\end{...}. + You have used \\begin{} without a corresponding \\end{}. """ - , ruleId: "hint_mismatched_environment3" - regexToMatch: /Error: No matching \\end found for `\\begin\{([^\}]+)\}'.*/ - newMessage: "Error: No matching \\end found for \\begin{$1}" + , + ruleId: "hint_mismatched_environment3" + types: ['environment'] + regexToMatch: /Warning: No matching \\end found for `\\begin\{([^\}]+)\}'.*/ + newMessage: "Warning: No matching \\end found for \\begin{$1}" humanReadableHint: """ - You have used \\begin{...} without a corresponding \\end{...}. + You have used \\begin{} without a corresponding \\end{}. """ - , ruleId: "hint_mismatched_environment3" - regexToMatch: /Error: Found `\\end\{([^\}]+)\}' without corresponding \\begin.*/ - newMessage: "Error: Found \\end{$1} without a corresponding \\begin{$1}" + , + ruleId: "hint_mismatched_environment4" + types: ['environment'] + cascadesFrom: ['environment'] + regexToMatch: /Error: Found `\\end\{([^\}]+)\}' without corresponding \\begin.*/ + newMessage: "Error: found \\end{$1} without a corresponding \\begin{$1}" humanReadableHint: """ - You have used \\begin{...} without a corresponding \\end{...}. + You have used \\begin{} without a corresponding \\end{}. """ ]