This resolves extranous "improper escape sequence" warnings on
python 3.6+[1].
Note, this does not resolve those warnings from pylint. There
is already another proposed patch to address pylint[2].
[1] https://review.opendev.org/494322
[2] https://review.opendev.org/635236
Change-Id: Ie160436913e4d935bab118d31ba10193ac38bd8f
This patch improves the unit test coverage for the local hacking checks.
It also removes the "no_author_tags" check as it is now covered in the
main hacking rule H105.
Change-Id: I4029f4fa2e28f4f50c1897b6216c0d8557b2a56b
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.
We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.
We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.
This patch also updates pylint to 1.5.6 which is compatible with
python3.
In updating pylint we have some issues to correct, this patch addresses
those issues so the Octavia code passes pylint 1.5.6.
Change-Id: Iec21f4c803a427059d595612336d67a35ebf9585
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This patch aligns all of Octavia to use oslo_log instead of the built
in python logging. This should provide consistent log formats.
It adds a hacking check to make sure "logging" doesn't come back into
the code.
Change-Id: I9b76c2bb5a5c396faf85df4606f2ca00f23de913
This patch creates the provider driver base class and exceptions.
See the "Enable Provider Driver Support" specification [1] for details.
[1] https://docs.openstack.org/octavia/latest/contributor/specs/version1.1/ \
enable-provider-driver.html
This patch also improves the wording of hacking check O316 for
assertIsInstance.
Change-Id: I4262b9a772c43a702372b8389320858f06ac9720
This also fix build-openstack-sphinx-docs, there was a change introduced
in sphinx 1.6.6:
https://github.com/sphinx-doc/sphinx/pull/4335/files
If the size of __init__.py is less than 2, then the module would be
skipped which will cause the sphinx consistency checking failing later.
Change-Id: I9d8764b6e907aceed8bb8a9b04711145d0eb32ad
This patch fixes a revert method that was not handling extra parameters
being passed to it.
It also adds a hacking check to make sure this does not happen in the
future.
The patch also breaks the bad habit of compiling regex strings for every
line of code in the project.
Change-Id: If29e377204432e215bfea97f9d76bce0a442f4c8
This patch updates the Octavia documentation in support of the
OpenStack documentation migration[1].
[1] https://specs.openstack.org/openstack/docs-specs/specs \
/pike/os-manuals-migration.html
Change-Id: I97fd038b8050bfe776c3fca8336d9090f8236362
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
- [O343] Python 3: do not use basestring.
- [O344] Python 3: do not use dict.iteritems.
- [O345] Usage of Python eventlet module not allowed
Change-Id: I0d70bbc4608cc08f0944b836814462acdcf7269f
we should avoid using six.iteritems to achieve iterators.
We can use dict.items instead, as it will return iterators in PY3 as well.
And dict.items/keys will be more readable.
In py2, the performance about list should be negligible
Change-Id: I153d91e884ef0ea0a760527f3dab2b8d5ed3e38e
Added hacking check to ensure not to use xrange. Also,
fixed issues with EoF missing newline [W391].
Change-Id: Iba8d240c042e46cb34eb6ed057534d62efb6f903
Closes-Bug: #1538118
The rule is not robust enough result in error code existing.
Fix the code and the rule.
Change-Id: I68934d4931a6e7857a824d0af5ed571a9c3e6480
Closes-bug: #1280522
Instead of using assert(Not)Equal(None, ***), developers should
use assertIs(Not)None(***) to have more clear messages in case of failure.
Change-Id: I20dd008badde8a3e87a367e7ab791ace4e117fb7
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this. This commit changes mutable default args with
None, then use 'arg = arg or {}', 'arg = arg or []'. For unit code which
doesn't use the args , just set with None. This commit also adds hacking
check.
Change-Id: Ib4f195c9c00ca2c49579f9d62648bff7c8109fcf
Closes-Bug: #1327473
In the past HACKING.rst file has not been updated when needed,
this patch update HACKING.rst file for all missing syntax checks.
Furthermore rules checks have been reorder in octavia/hacking/checks.py file.
Change-Id: I34bdcca5d4cc9abad797aff118fbf4e563c42757
Octavia doesn't have hacking rules to check "assert" usages like:
- assertTrue(isinstance(A, class A))
- assertEqual(A, None) or assertEqual(None, A)
- assertEqual(False, A) or assertEqual(True, A)
- assertEqual(a in b, True) or assertEqual(a in b, False)
This patch introduce hacking rules just above.
Change-Id: If64402508226608b5700c8bb11e924dbc778fec3
Closes-Bug: #1511368
This is for fixing the octavia issue.
We ran the Octavia code base through a static code analyser and several issues got flagged.
As an exercise we looked at each issue and are now proposing fixes to the complexity/code style issues.
Change-Id: I2fc0cf213a9f7488e7cf1dff789d98ca2deeb81f