Adds doc8 check to pep8

This patch adds doc8 check for .rst files to pep8.
Files that fail doc8 check are also fixed.

Change-Id: Ib8556b6eac0fb5a9bd3b7f8dcf000ab1b23e23bc
This commit is contained in:
Dao Cong Tien 2018-07-12 16:05:25 +07:00 committed by Luka Peschke
parent d4eea2537c
commit b3ae81dc92
10 changed files with 63 additions and 40 deletions

View File

@ -13,15 +13,17 @@ Cloudkitty Specific Commandments
- [C311] Use assertIsNone(...) instead of assertEqual(None, ...).
- [C312] Use assertTrue(...) rather than assertEqual(True, ...).
- [C313] Validate that logs are not translated.
- [C314] str() and unicode() cannot be used on an exception. Remove or use six.text_type().
- [C314] str() and unicode() cannot be used on an exception.
Remove or use six.text_type().
- [C315] Translated messages cannot be concatenated. String should be
included in translated message.
- [C317] 'oslo_' should be used instead of 'oslo.'
- [C317] `oslo_` should be used instead of `oslo.`
- [C318] Must use a dict comprehension instead of a dict constructor
with a sequence of key-value pairs.
- [C319] Ensure to not use xrange().
- [C320] Do not use LOG.warn as it's deprecated.
- [C321] Ensure that the _() function is explicitly imported to ensure proper translations.
- [C321] Ensure that the _() function is explicitly imported to ensure
proper translations.
LOG Translations
----------------

View File

@ -85,7 +85,8 @@ want to install it on an older system, use a virtualenv.
Getting release notes
---------------------
Release notes can be found in the `release notes section`_ of the documentation.
Release notes can be found in the `release notes section`_ of the
documentation.
.. Global references and images

View File

@ -8,9 +8,13 @@ with DevStack.
Configure DevStack to run CloudKitty
====================================
.. code-block:: bash
$ DEVSTACK_DIR=/path/to/devstack
1. Enable Ceilometer::
1. Enable Ceilometer:
.. code-block:: bash
$ cd ${DEVSTACK_DIR}
$ cat >> local.conf << EOF
@ -19,7 +23,9 @@ Configure DevStack to run CloudKitty
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer.git master
EOF
2. Enable CloudKitty::
2. Enable CloudKitty:
.. code-block:: bash
$ cd ${DEVSTACK_DIR}
cat >> local.conf << EOF
@ -28,14 +34,18 @@ Configure DevStack to run CloudKitty
enable_service ck-api, ck-proc
EOF
3. Set CloudKitty collector to gnocchi::
3. Set CloudKitty collector to gnocchi:
.. code-block:: bash
$ cd ${DEVSTACK_DIR}
cat >> local.conf << EOF
CLOUDKITTY_COLLECTOR=gnocchi
EOF
Run devstack as usual::
Run devstack as usual:
.. code-block:: bash
$ ./stack.sh

View File

@ -153,8 +153,8 @@ the ``mysql`` client::
GRANT ALL PRIVILEGES ON cloudkitty.* TO 'CK_DBUSER'@'localhost' IDENTIFIED BY 'CK_DBPASSWORD';
EOF
If you need to authorize the mysql user associated to cloudkitty from another host you
have to change the line accordingly.
If you need to authorize the mysql user associated to cloudkitty from another
host you have to change the line accordingly.
Run the database synchronisation scripts::
@ -174,10 +174,10 @@ cloudkitty uses Keystone for authentication, and provides a ``rating`` service.
To integrate cloudkitty to Keystone, run the following commands (as OpenStack
administrator)::
openstack user create cloudkitty --password CK_PASSWORD --email cloudkitty@localhost
openstack user create cloudkitty --password CK_PASSWORD \
--email cloudkitty@localhost
openstack role add --project service --user cloudkitty admin
Give the ``rating`` role to ``cloudkitty`` for each project that should be
handled by cloudkitty::

View File

@ -5,8 +5,8 @@ Policy configuration
Configuration
~~~~~~~~~~~~~
The following is an overview of all available policies in Cloudkitty. For a sample
configuration file, refer to :doc:`samples/policy-yaml`.
The following is an overview of all available policies in Cloudkitty.
For a sample configuration file, refer to :doc:`samples/policy-yaml`.
.. show-policy::
:config-file: ../../etc/oslo-policy-generator/cloudkitty.conf

View File

@ -2,17 +2,18 @@
Storage backend (v2)
====================
.. warning:: This backend is considered unstable and should be used for upstream
development only.
.. warning:: This backend is considered unstable and should be used for
upstream development only.
In order to implement a storage backend for cloudkitty, you'll have to implement
the following abstract class:
In order to implement a storage backend for cloudkitty, you'll have to
implement the following abstract class:
.. autoclass:: cloudkitty.storage.v2.BaseStorage
:members:
You'll then need to register an entrypoint corresponding to your storage backend
in the ``cloudkitty.storage.v2.backends`` section of the ``setup.cfg`` file.
You'll then need to register an entrypoint corresponding to your storage
backend in the ``cloudkitty.storage.v2.backends`` section of the ``setup.cfg``
file.
Testing
=======

View File

@ -6,10 +6,11 @@ The following is a sample Cloudkitty policy file that has been auto-generated
from default policy values in code. If you're using the default policies, then
the maintenance of this file is not necessary, and it should not be copied into
a deployment. Doing so will result in duplicate policy definitions. It is here
to help explain which policy operations protect specific Cloudkitty APIs, but it
is not suggested to copy and paste into a deployment unless you're planning on
providing a different policy for an operation that is not the default.
to help explain which policy operations protect specific Cloudkitty APIs, but
it is not suggested to copy and paste into a deployment unless you're planning
on providing a different policy for an operation that is not the default.
The sample policy file can also be viewed in `file form <_static/policy.yaml.sample>`_.
The sample policy file can also be viewed in
`file form <_static/policy.yaml.sample>`_.
.. literalinclude:: _static/policy.yaml.sample

View File

@ -41,3 +41,5 @@ oslotest==1.10.0 # Apache-2.0
sphinxcontrib-pecanwsme==0.8 # Apache-2.0
reno==1.8.0 # Apache2
sphinxcontrib-httpdomain==1.6.0 # Apache-2.0
doc8==0.6.0 # Apache-2.0
Pygments==2.2.0 # BSD

View File

@ -18,3 +18,5 @@ oslotest>=1.10.0 # Apache-2.0
sphinxcontrib-httpdomain>=1.6.0 # BSD
sphinxcontrib-pecanwsme>=0.8 # Apache-2.0
reno>=1.8.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
Pygments>=2.2.0 # BSD license

View File

@ -25,6 +25,7 @@ commands = oslo_debug_helper {posargs}
basepython = python3
commands =
flake8 {posargs} cloudkitty
doc8 {posargs}
[testenv:cover]
basepython = python3
@ -60,6 +61,9 @@ filename = *.py,app.wsgi
exclude = .git,.venv,.tox,dist,doc,*egg,build,.ropeproject,releasenotes
ignore = H105
[doc8]
ignore-path = .venv,.git,.tox,.tmp,*cloudkitty/locale*,*lib/python*,cloudkitty.egg*,doc/build,releasenotes/*
[hacking]
import_exceptions = cloudkitty.i18n
local-check-factory = cloudkitty.hacking.checks.factory