Turns out that the 'ViewList.append' function takes a third argument,
'offset', to indicate where in the source an error is occurring. Start
using this to improve the quality of the error messages we get from
poorly formatted options. Given that we don't actually modify the source
file, it's also necessary to write the output from the directive to an
intermediate temp file.
This also fixes the order of imports, given that we're adding new
imports as we go.
Reviewed: https:/ /review. openstack. org/554632 /git.openstack. org/cgit/ openstack/ oslo.config/ commit/ ?id=eb6b43ba066 98d37e2d8090335 e0082f0a6dfdb5
Committed: https:/
Submitter: Zuul
Branch: master
commit eb6b43ba06698d3 7e2d8090335e008 2f0a6dfdb5
Author: Stephen Finucane <email address hidden>
Date: Tue Mar 20 16:29:07 2018 +0000
sphinxext: Reporting correct lines for errors
Previously, we had an issue whereby errors found in the generated source
would result in the following, rather unhelpful error messages:
< oslo_config. sphinxext> :1: WARNING: Unexpected indentation.
Turns out that the 'ViewList.append' function takes a third argument,
'offset', to indicate where in the source an error is occurring. Start
using this to improve the quality of the error messages we get from
poorly formatted options. Given that we don't actually modify the source
file, it's also necessary to write the output from the directive to an
intermediate temp file.
This also fixes the order of imports, given that we're adding new
imports as we go.
Change-Id: I6f679662970592 6dbed5015f20d47 187b77c9c50
Related-Bug: #1755783