Use doc8 style checker

This uses the doc8 style checker to check that the documents
conform to certain requirements, as documented at
https://pypi.python.org/pypi/doc8.

In particular, we no longer need to check for these in our test code
since they are checked via doc8:
- lines don't exceed 79 chars
- there are no trailing spaces
- there are no carriage returns

Some existing specs were modified because they had tabs or no newlines
at the end of the file.

Change-Id: If27281c7efd60c9f15ca07c723dd94a7d086c325
This commit is contained in:
Ruby Loo 2015-09-30 16:20:16 +00:00 committed by John L. Villalovos
parent 9b06d9b624
commit db259bfc1b
6 changed files with 23 additions and 39 deletions

View File

@ -142,4 +142,5 @@ HP iLO4 User Guide:
http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-c03334051-10.pdf
HP Power Capping and HP Dynamic Power Capping
http://bit.ly/1m8sbEi
http://bit.ly/1m8sbEi

View File

@ -244,4 +244,5 @@ References
* Proposed patch in python-swiftclient: https://review.openstack.org/#/c/102632/
* Glance direct_url configuration: https://github.com/openstack/glance/blob/master/etc/glance-api.conf#L89
* Glance direct_url configuration: https://github.com/openstack/glance/blob/master/etc/glance-api.conf#L89

View File

@ -41,15 +41,15 @@ Proposed change
To reset the secure boot keys to manufacturer's defaults.
(Applicable if secure boot feature is supported for ironic drivers)
- clear_secure_boot_keys()
To clear secure boot keys
To clear secure boot keys
(Applicable if secure boot feature is supported for ironic drivers)
* The suggested default ordering would be -
reset_ilo_credential() 9
reset_secure_boot_keys() 8
apply_base_firmware_settings() 7
ilo_reset() 6
reset_ilo_credential() 9
reset_secure_boot_keys() 8
apply_base_firmware_settings() 7
ilo_reset() 6
* The priority of clear_secure_boot_keys() by default would be zero, operator
would have option to choose either reset_secure_boot_keys or
@ -72,10 +72,10 @@ Proposed change
eg: Following are the mandatory parameter keys required by the clean steps -
1. ``upgrade_firmware`` - ``ilo_firmware_location_url`` key,
which can accept the http location url or swift url for the tar/gz
file of all the firmwares to be updated.
file of all the firmwares to be updated.
2. ``reset_ilo_credential`` - ``ilo_change_password``, which accepts the
default iLO password to be changed during cleaning.
default iLO password to be changed during cleaning.
* If the keys are missing and if the respective clean step is enabled, warning
message will be logged and the step will be no-op and continue with other

6
test-requirements.txt Normal file
View File

@ -0,0 +1,6 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
doc8 # Apache-2.0

View File

@ -79,28 +79,6 @@ class TestTitles(testtools.TestCase):
self.fail("While checking '%s':\n %s"
% (filename, "\n ".join(msgs)))
def _check_lines_wrapping(self, tpl, raw):
for i, line in enumerate(raw.split("\n")):
if "http://" in line or "https://" in line:
continue
self.assertTrue(
len(line) < 80,
msg="%s:%d: Line limited to a maximum of 79 characters." %
(tpl, i+1))
def _check_no_cr(self, tpl, raw):
matches = re.findall('\r', raw)
self.assertEqual(
len(matches), 0,
"Found %s literal carriage returns in file %s" %
(len(matches), tpl))
def _check_trailing_spaces(self, tpl, raw):
for i, line in enumerate(raw.split("\n")):
trailing_spaces = re.findall(" +$", line)
self.assertEqual(len(trailing_spaces),0,
"Found trailing spaces on line %s of %s" % (i+1, tpl))
def _check_file_ext(self, filename):
self.assertTrue(filename.endswith(".rst"),
"spec's file must uses 'rst' extension.")
@ -169,9 +147,6 @@ class TestTitles(testtools.TestCase):
(data, titles) = self._get_spec_titles(filename)
self._check_titles(filename, template_titles, {}, titles)
self._check_lines_wrapping(filename, data)
self._check_no_cr(filename, data)
self._check_trailing_spaces(filename, data)
self._check_license(data)
self._check_filename(filename, data)
@ -184,7 +159,4 @@ class TestTitles(testtools.TestCase):
(data, titles) = self._get_spec_titles(filename)
self._check_titles(filename, DRAFT_REQUIRED_TITLES,
template_titles, titles)
self._check_lines_wrapping(filename, data)
self._check_no_cr(filename, data)
self._check_trailing_spaces(filename, data)
self._check_filename(filename, data)

View File

@ -8,8 +8,12 @@ usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
python setup.py testr --slowest --testr-args='{posargs}'
doc8 specs/ doc/source README.rst
[testenv:venv]
commands = {posargs}