The cinder.hacking.checks Module

check_explicit_underscore_import(logical_line, filename)

Check for explicit import of the _ function

We need to ensure that any files that are using the _() function to translate logs are explicitly importing the _ function. We can’t trust unit test to catch whether the import has been added so we need to check for it here.

check_no_log_audit(logical_line)

Ensure that we are not using LOG.audit messages

Plans are in place going forward as discussed in the following spec (https://review.openstack.org/#/c/91446/) to take out LOG.audit messages. Given that audit was a concept invented for OpenStack we can enforce not using it.

factory(register)
no_mutable_default_args(logical_line)
no_translate_debug_logs(logical_line, filename)

Check for ‘LOG.debug(_(‘

As per our translation policy, https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation we shouldn’t translate debug level logs.

  • This check assumes that ‘LOG’ is a logger.
  • Use filename so we can start enforcing this in specific folders instead of needing to do so all at once.

N319

no_vi_headers(physical_line, line_number, lines)

Check for vi editor configuration in source files.

By default vi modelines can only appear in the first or last 5 lines of a source file.

N314

Previous topic

The cinder.flow_utils Module

Next topic

The cinder.i18n Module

This Page