diff --git a/.github/workflows/doc-problem-match.json b/.github/workflows/doc-problem-match.json new file mode 100644 index 00000000000..8069361dd38 --- /dev/null +++ b/.github/workflows/doc-problem-match.json @@ -0,0 +1,16 @@ +{ + "problemMatcher": [ + { + "owner": "latex-parser", + "pattern": [ + { + "regexp": "^\\[LATEX(WARNING|ERROR)::(.*?):(\\d+)::(.*?)\\]$", + "severity": 1, + "file": 2, + "line": 3, + "message": 4 + } + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 6f738a304da..491f604cbae 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -23,7 +23,10 @@ jobs: - name: Configure CMake working-directory: ${{runner.workspace}}/EnergyPlus/doc/build - run: cmake -DTEX_INTERACTION=batchmode .. + run: cmake -DTEX_INTERACTION=batchmode -DDOCS_TESTING=ON .. + + - name: Add problem matcher + run: echo "::add-matcher::.github/workflows/doc-problem-match.json" - name: Build Docs working-directory: ${{runner.workspace}}/EnergyPlus/doc/build diff --git a/doc/tools/parse_latex_log.py b/doc/tools/parse_latex_log.py index a91f35e9c02..e5c00e933ef 100644 --- a/doc/tools/parse_latex_log.py +++ b/doc/tools/parse_latex_log.py @@ -168,40 +168,6 @@ def find_multiply_defined_labels(root_dir, label): target = "\\label{" + label + "}" return find_locations(root_dir, target) - -def parse_warning(line, src_dir): - """ - - line: string, the line to parse - - src_dir: string, the root directory of the LaTeX source files - RETURN: None or one of: - - {'type': 'Label multiply defined', - 'label': string, - 'message': string} - - {'type': 'Hyper reference undefined', - 'label': string, - 'message': string} - """ - m = LABEL_MULTIPLY_DEFINED_WARN.match(line) - if m is not None: - label = m.group(1) - locations = find_multiply_defined_labels(src_dir, label) - return {'severity': SEVERITY_WARNING, - 'type': "Label multiply defined", - 'locations': locations, - 'message': line, - 'label': m.group(1)} - m = HYPER_UNDEFINED_WARN.match(line) - if m is not None: - label = m.group(1) - locations = find_undefined_hyperref(src_dir, label) - return {'severity': SEVERITY_WARNING, - 'type': "Hyper reference undefined", - 'locations': locations, - 'message': line, - 'label': m.group(1)} - return None - - def parse_line_number(message): """ - message: string @@ -233,41 +199,56 @@ def __init__(self, log_path, src_dir, verbose=False): self.src_dir = src_dir self.verbose = verbose - def _read_tex_error(self, line): + def _read_tex_error(self): line_no = parse_line_number(self._current_issue) self._issues['issues'].append({ - 'severity': SEVERITY_ERROR, + 'level': SEVERITY_ERROR, 'type': self._type, - 'locations': [{ - 'file': self._current_tex_file, - 'line': line_no}], + 'path': self._current_tex_file, + 'line': {"start": line_no, "end": line_no}, 'message': self._current_issue.strip()}) - def _read_warning(self, line): - warn = parse_warning(self._current_issue, self.src_dir) - if self._current_issue.strip() not in ISSUES_TO_SKIP: - if warn is not None: - self._issues['issues'].append(warn) - else: - line_no = parse_on_input_line(self._current_issue) - self._issues['issues'].append({ - 'severity': SEVERITY_WARNING, - 'type': self._type, - 'locations': [{ - 'file': self._current_tex_file, - 'line': line_no}], - 'message': self._current_issue.strip()}) - - def _read_error(self, line): - if self._current_issue not in ISSUES_TO_SKIP: + def _read_warning(self): + warns = [] + m1 = LABEL_MULTIPLY_DEFINED_WARN.match(self._current_issue) + m2 = HYPER_UNDEFINED_WARN.match(self._current_issue) + if m1 is not None: + label = m1.group(1) + locations = find_multiply_defined_labels(self.src_dir, label) + for loc in locations: + warns.append({ + 'level': SEVERITY_WARNING, + 'type': "Label multiply defined", + 'path': loc["file"], + 'line': {"start": loc["line"], "end": loc["line"]}, + 'message': self._current_issue.strip(), + 'label': m1.group(1) + }) + elif m2 is not None: + label = m2.group(1) + locations = find_undefined_hyperref(self.src_dir, label) + for loc in locations: + warns.append({ + 'level': SEVERITY_WARNING, + 'type': "Hyper reference undefined", + 'path': loc["file"], + 'line': {"start": loc["line"], "end": loc["line"]}, + 'message': self._current_issue.strip(), + 'label': m2.group(1) + }) + elif self._current_issue.strip() not in ISSUES_TO_SKIP: line_no = parse_on_input_line(self._current_issue) - self._issues['issues'].append({ - 'severity': SEVERITY_ERROR, + warns = [{ + 'level': SEVERITY_WARNING, 'type': self._type, - 'locations': [{ - 'file': self._current_tex_file, - 'line': line_no}], - 'message': self._current_issue.strip()}) + 'path': self._current_tex_file, + 'line': {"start": line_no, "end": line_no}, + 'message': self._current_issue.strip()}] + self._issues['issues'] += warns + + def _read_error(self): + if self._current_issue not in ISSUES_TO_SKIP: + self._read_tex_error() def _read_issue(self, line): is_ws = (line.strip() == "") @@ -275,11 +256,11 @@ def _read_issue(self, line): nonempty = len(line) > 1 if is_ws and (not (first_line and nonempty)): if self._in_tex_err: - self._read_tex_error(line) + self._read_tex_error() elif self._in_warn: - self._read_warning(line) + self._read_warning() elif self._in_err: - self._read_error(line) + self._read_error() else: raise Exception("unhandled issue read") self._reset_after_read() @@ -388,16 +369,10 @@ def update_paths_to_be_from_repo_root(issues, repo_root_to_src): updated = [] for issue in issues: update = copy.deepcopy(issue) - if 'locations' in update: - new_locs = [] - for location in update['locations']: - loc = copy.deepcopy(location) - if 'file' in location: - loc['file'] = os.path.join( - repo_root_to_src, - location['file']) - new_locs.append(loc) - update['locations'] = new_locs + if 'path' in update: + update['path'] = os.path.join( + repo_root_to_src, + update['path']) updated.append(update) return updated @@ -440,16 +415,14 @@ def find_issues(log_path, json_error_path, src_dir): f = sys.stdout for issue in errs['issues']: f.write("[LATEX") - f.write(issue['severity'] + "::") - locs = [loc['file'] + ":" + str(loc['line']) - for loc in issue['locations']] - f.write(",".join(locs) + "::") + f.write(issue['level'] + "::") + f.write(issue['path'] + ":" + str(issue["line"]["start"])) msg = issue['message'].replace("\r\n", " ") msg = msg.replace("\n", " ") msg = msg.replace("\r", " ") msg = msg.replace("\t", " ") msg = " ".join(msg.split()) - f.write(msg + "]\n") + f.write("::" + msg + "]\n") with open(json_error_path, 'w', encoding='utf-8') as f: json.dump(errs, f, ensure_ascii=False, indent=4) return (num_issues > 0) diff --git a/third_party/.gitignore b/third_party/.gitignore index 160acb328b4..6ce591f34ab 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore @@ -30,7 +30,8 @@ kiva-ep/README.md # submodules penumbra/.gitmodules +btwxt/.gitmodules -# unused btwxt repo directories/files +# unused repo directories/files btwxt/vendor/googletest -btwxt/.gitmodules +penumbra/vendor/googletest diff --git a/third_party/penumbra/.gitmodules b/third_party/penumbra/.gitmodules deleted file mode 100644 index bdd892eb741..00000000000 --- a/third_party/penumbra/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "vendor/glfw"] - path = vendor/glfw - url = https://github.com/glfw/glfw.git -[submodule "vendor/libtess2"] - path = vendor/libtess2 - url = https://github.com/bigladder/libtess2.git -[submodule "vendor/googletest"] - path = vendor/googletest - url = https://github.com/google/googletest.git \ No newline at end of file diff --git a/third_party/penumbra/vendor/googletest b/third_party/penumbra/vendor/googletest deleted file mode 160000 index 2fe3bd994b3..00000000000 --- a/third_party/penumbra/vendor/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2fe3bd994b3189899d93f1d5a881e725e046fdc2