-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion to treat warnings as errors in sphinx-build #256
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #256 +/- ##
=======================================
Coverage 99.76% 99.76%
=======================================
Files 14 14
Lines 866 866
=======================================
Hits 864 864
Misses 2 2 ☔ View full report in Codecov by Sentry. |
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 like this @sfmig, that particular loophole has created a few problems for us already and it'd be nice to close.
I'd ask you to also update the sphinx-build
commands in "Building the documentation locally" section of the contributing guide (under the "All platforms" tabs). The -W --keep-going
should also be included there in case people cannot (or choose to not) use the make
command.
I'd also favour updating the corresponding NIU action.
eb7d96e
to
2d553c9
Compare
One question to our Make expert @lochhh: Should we add the flags |
😄 no Make expert, but I think we should use |
If |
I'm not a fan of this, as it would results in differences between local build vs CI, which could be confusing during debugging. I think we should try to stick to the rule that local vs CI checks should be as similar as possible. |
Just to clarify, adding them to SPHINXOPTS would only apply the flags to the |
Thanks for the clarifications. Then my initial suggestion for also adding these flags to the |
Ok just to recap:
This way both documented ways of building the docs locally (via make, or via explicit Thanks both! |
Quality Gate passedIssues Measures |
Description
What is this PR
Why is this PR needed?
On issue #252, @lochhh pointed out that
sphinx-build
returns a successful exit code (0) even if it encountered errors.This can be quite annoying: in practice it means we need to remember to manually check the logs of the docs building action (or locally), to confirm that there were no errors, even if the action shows a pass ✅ .
For example, in the case @lochhh caught, the docstrings were not rendered correctly in the API reference, but the action was passing.
The simplest workaround seems to add the flags
-W --keep-going
so thatsphinx-build
runs to completion, but treating warnings as errors and returning a non-zero exit code if there are errors or warnings.What does this PR do?
This PR adds the flags
-W --keep-going
to our Makefile. Open to discussion though!Question:
Should we add these flags to the neuroinformatics action too? It may be useful for everyone. If we agree we go for this, I am happy to do it.
References
movement.validators.files.ValidVIATracksCSV
docs #252, and also the PRs mentioned in that issueHow has this PR been tested?
I manually checked the exit code from
sphinx-build
with and without the proposed flags, in two situations:Case 1:
sphinx-build
returns a warning onlyTo reproduce:
movement.io.load_bboxes
-->from_numpy
) to indent something under the parameter section.make clean html
from the docs directoryCase 2:
sphinx-build
returns an errorTo reproduce:
movement.io.load_bboxes
-->from_numpy
) to indent something under the main summary line, but before the Parameters section.make clean html
from the docs directoryIn both cases, if we run
make clean html
sphinx-build
in the Makefile ---> I get exit code 0-W --keep-going
added tosphinx-build
in the Makefile---> I get exit code 2Is this a breaking change?
No.
Does this PR require an update to the documentation?
I added a comment to the workflow file to clarify
Checklist: