octavia.hacking package

octavia.hacking package

Submodules

octavia.hacking.checks module

assert_equal_in(logical_line)[source]

Check for assertEqual(A in B, True), assertEqual(True, A in B),

assertEqual(A in B, False) or assertEqual(False, A in B) sentences

O338

assert_equal_or_not_none(logical_line)[source]

Check for assertEqual(A, None) or assertEqual(None, A) sentences,

assertNotEqual(A, None) or assertNotEqual(None, A) sentences

O318

assert_equal_true_or_false(logical_line)[source]

Check for assertEqual(True, A) or assertEqual(False, A) sentences

O323

assert_true_instance(logical_line)[source]

Check for assertTrue(isinstance(a, b)) sentences

O316

check_line_continuation_no_backslash(logical_line, tokens)[source]

O346 - Don’t use backslashes for line continuation.

Parameters:
  • logical_line – The logical line to check. Not actually used.
  • tokens – List of tokens to check.
Returns:

None if the tokens don’t contain any issues, otherwise a tuple is yielded that contains the offending index in the logical line and a message describe the check validation failure.

check_no_basestring(logical_line)[source]

O343 - basestring is not Python3-compatible.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
check_no_eventlet_imports(logical_line)[source]

O345 - Usage of Python eventlet module not allowed.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
check_python3_no_iteritems(logical_line)[source]

O344 - Use dict.items() instead of dict.iteritems().

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
check_raised_localized_exceptions(logical_line, filename)[source]

O342 - Untranslated exception message.

Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

factory(register)[source]
no_author_tags(physical_line)[source]
no_log_warn(logical_line)[source]

Disallow ‘LOG.warn(‘

O339

no_mutable_default_args(logical_line)[source]
no_translate_logs(logical_line, filename)[source]

O341 - Don’t translate logs.

Check for ‘LOG.*(_(‘ and ‘LOG.*(_Lx(‘

Translators don’t provide translations for log messages, and operators asked not to translate them.

  • This check assumes that ‘LOG’ is a logger.
Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

no_xrange(logical_line)[source]

Disallow ‘xrange()’

O340

revert_must_have_kwargs(logical_line)[source]

O347 - Taskflow revert methods must have **kwargs.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.