Enable H904 check

H904  String interpolation should be delayed to be handled by the
logging code, rather than being done at the point of the logging call.
Use ',' instead of '%'.

See: https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages

Change-Id: I66ea69fe877fa57a54e06c22221cdd1f3414ef16
Related-Bug: #1596829
This commit is contained in:
Ngo Quoc Cuong 2017-07-05 03:39:22 -04:00
parent 7539e4510b
commit 4e615d6da6
5 changed files with 9 additions and 10 deletions

View File

@ -98,10 +98,8 @@ class KeycloakAuthMiddleware(base_middleware.Middleware):
time=CONF.keycloak_oidc.token_cache_time)
info = resp.json()
LOG.debug(
"HTTP response from OIDC provider: %s" %
pprint.pformat(info)
)
LOG.debug("HTTP response from OIDC provider: %s",
pprint.pformat(info))
return info

View File

@ -73,14 +73,14 @@ def save_blob_to_store(blob_id, blob, context, max_size,
store_type = None
data = utils.LimitingReader(utils.CooperativeReader(blob), max_size)
LOG.debug('Start uploading blob %s.' % blob_id)
LOG.debug('Start uploading blob %s.', blob_id)
if store_type == 'database':
location = database_api.add_to_backend(
blob_id, data, context, verifier)
else:
(location, size, md5checksum, __) = backend.add_to_backend(
CONF, blob_id, data, 0, store_type, context, verifier)
LOG.debug('Uploading of blob %s is finished.' % blob_id)
LOG.debug('Uploading of blob %s is finished.', blob_id)
checksums = {"md5": data.md5.hexdigest(),
"sha1": data.sha1.hexdigest(),

View File

@ -167,7 +167,7 @@ def _create_or_update(context, artifact_id, values, session):
artifact.update(values)
LOG.debug('Sending request to the database. '
'New values are %s' % values)
'New values are %s', values)
artifact.save(session=session)
LOG.debug('Response from the database was received.')

View File

@ -155,7 +155,7 @@ class Scrubber(object):
@staticmethod
def _scrub_artifact(af):
LOG.info("Begin scrubbing of artifact %s" % af.id)
LOG.info("Begin scrubbing of artifact %s", af.id)
for blob in af.blobs:
if not blob.external:
try:
@ -168,4 +168,4 @@ class Scrubber(object):
# delete artifact itself
db_api.delete(context, af.id, db_api.get_session())
LOG.info("Artifact %s was scrubbed" % af.id)
LOG.info("Artifact %s was scrubbed", af.id)

View File

@ -66,7 +66,8 @@ commands = bandit -c bandit.yaml -r glare -n5 -p gate
# H405 multi line docstring summary not separated with an empty line
ignore = H404,H405
exclude = .venv,.git,.tox,dist,doc,etc,*glare/locale*,*lib/python*,*egg,build
enable-extensions = H106,H203
# H904 Delay string interpolations at logging calls.
enable-extensions = H106,H203,H904
[hacking]
local-check-factory = glare.hacking.checks.factory