-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix latex issues via value added scripts #8027
Fix latex issues via value added scripts #8027
Conversation
…er more than one line
The script now only will write a JSON file if issues are found. If no issues are found, no file is written. "Text" based log messages are streamed to stdout, one issue per line. If issues are found, a non-zero exit code is used for helping ctest detect issues found.
…-value-added-scripts
Note: a second clause is also added to docs/CMakeLists.txt should a user be doing a "docs-only" build.
This looks great! CI caught the warnings and parsed them out nicely. However, we need to remove the other warnings that were already present before the CI improvements. If you can clean those up, I think we'll be good to go. |
And to be clear, there are a couple options:
I don't care either way. Once both of those steps are done, however, mark this as ready for review and we'll get it in. Thanks @nealkruis @michael-okeefe |
We can either pipe stdout into a txt file, or have an option to silence the python script output. If I'm understanding things correctly, that would mean that we would see the three tests fail, but there wouldn't be any output below them. This would be followed by the new failure messages from parsing the *_errors.json files. We could change it so that executing the python script is just another custom target or custom command in CMake instead of a CTest. That way you wouldn't see the extra failed tests. Either way, once we get that sorted out, we'll clean up the actual LaTeX warnings/errors so this can go in cleanly. |
Yep, this would be ideal. Please make it so, but leave the LaTeX warnings in place, and we'll make sure it all looks good, then do one clean commit and merge. Thanks! |
Results are in! It definitely prevents other tests from being run successfully if python sends a bad return code. @michael-okeefe let's set it up to always return zero so it doesn't prevent other tests from running. @Myoldmopar since these aren't really Test Results, would it make sense to have the CI put them somewhere else (e.g., in "Build Messages" or in a separate section just for documentation)? |
…prevent stopping ctest when run
I just modified the script so that it never returns a non-zero exit code and pushed that up (it was already on-par with the latest from develop). Shall I also start cleaning up the remaining LaTeX issues that were identified? |
This looks fantastic. Once you address those LaTeX issues and we get a clean build we'll merge this in. Thanks for the refinements here, @nealkruis @michael-okeefe ! |
Oh, and about your comment on the build results/test results. Unfortunately, since this is run as a post-processing ctest, I think it's too late for CI to grab these as "build results". But they do show up fine as parsed test results. |
Sounds great. I just started on addressing the last of the LaTeX issues. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty great as-is, though a couple thoughts came to mind that could be considered:
- Do we want to make DOCS_TESTING just an internal variable, nothing exposed to the cache?
- If the doc test is run as a post build step, I would be happy to tell CI to search for the
errors.json
files after the build rather than after the test.
# we are making *a Python 3 Interpreter* a required dependency, so find it here | ||
find_package(PythonInterp 3 REQUIRED) | ||
# we are making *a Python 3.6 Interpreter* a required dependency, so find it here | ||
find_package(PythonInterp 3.6 REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometime in the future we need to move away from this PythonInterp as it was deprecated in 2018 in favor of find_package(Python3)
, but first we need to move our minimum cmake up.
CMakeLists.txt
Outdated
@@ -337,6 +337,7 @@ if( BUILD_PACKAGE ) | |||
endif() | |||
|
|||
if (BUILD_DOCS) | |||
set(DOCS_TESTING ${BUILD_TESTING} CACHE BOOL "" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so as soon as you enable both BUILD_DOCS and BUILD_TESTING, this will be forced to ON. No problem. Since this is automatically triggered to ON/OFF, I wonder if we should either mark it advanced, or just take it out of the cache entirely and treat it like a local cmake variable.
if(NOT EXISTS ${PYTHON_EXECUTABLE}) | ||
# we are making *a Python 3.6 Interpreter* a required dependency, so find it here | ||
find_package(PythonInterp 3.6 REQUIRED) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool to just reuse the previously found Python, but I know that may be an annoying thing to manage, so it's OK.
POST_BUILD | ||
COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/parse_latex_log.py" "${PROJECT_SOURCE_DIR}/${SOURCE_FILENAME}/${SOURCE_FILENAME}.log" "${PROJECT_SOURCE_DIR}/${SOURCE_FILENAME}" "${PROJECT_BINARY_DIR}/${OUTPUT_FILENAME}_errors.json" | ||
) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so if this is just a POST_BUILD on the PDF building portion, then the file should be available once "make" is complete. In this case, I think I actually could have CI find the error files early enough to catch these as build errors, not test failures. Let me know if I am correct in the build step and I can make an alteration to CI.
doc/tools/parse_latex_log.py
Outdated
'plant-application-guide', | ||
'tips-and-tricks-using-energyplus', | ||
'using-energyplus-for-compliance', | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this list really there just for testing? Or is this something we have to maintain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was debating about this and ended up leaving it in as I found it useful but you are right -- it could become a maintenance issue if anyone else were to depend on it. On a second look, I'd vote to just remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed this and the remaining LaTeX issues that were flagged. Just pushed that up.
I also added a check in the python script to delete the target JSON file if it exists before writing as a persistent JSON error file would be confusing for those working off of their local laptops and actively fixing issues.
It appears there was an attempt to hyperref these from Engineering Reference to Input/Output Reference. Otherwise, there is not other label target for those. I did a case insensitive search and also searched for any label{...} with the first part of the hyperref tags.
Section-level was skipped so adjusted all heading levels accordingly.
Remove special case for parse_latex_log.py. Best to just use the standard build tooling via CMake.
The header-level jumps from Chapter to subsection and skips section level. This edit corrects that.
Since the presence of the JSON file indicates that issues are found, this prevents someone from running, finding and fixing errors, and then re-running (all fixed) but the json file is still there so they think the errors haven't been fixed.
This looks great! I'm not sure why Mac hasn't reported yet, but Mac wasn't involved, so I'm OK with not waiting on Mac for this. The only comment I had unresolved was whether we should just eliminate the DOCS_TESTING cache variable since it is controlled via the two cache variables BUILD_DOCS and BUILD_TESTING. This doesn't have to be held up for that, but I'd like to know what you think of that change at least. |
We'll still need DOCS_TESTING for the documentation CMake project (if it's created independently). I'll make it an internal variable in the EnergyPlus CMake project. |
I don't see how this could've broken that one failing Windows file. I'm feeling OK with just letting this merge as-is. I've got a branch of Decent CI that moves the "test errors" into "build errors" which is much more appropriate here. I won't worry about merging that immediately but I'll try some time soon. |
Pull request overview
Purpose and Approach
Fixes Misc. LaTeX Errors Not Caught in Normal Workflow by adding a python-based LaTeX log parsing capability in Python that summarizes the relevant issues and warnings in the LaTeX log files by file and line number and also adds a JSON summary of the specific issues that can be further processed and/or displayed by the CI. This pull request also then fixes the majority of these issues across all the docs. These issues include package-based issues and warnings (for e.g., issues reported by \siunits) as well as issues and warnings from both the TeX and LaTeX processing pipeline.
The only new code added is the
doc/tools/parse_latex_log.py
file. That file uses no external dependencies beyond the python standard library. Fixes to the docs were found and fixed using the errors and warnings reported by the LaTeX log parser. The hope is that this script will make LaTeX errors and warnings more visible and actionable for future EnergyPlus documentation authors.Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.