hacking log warn

LOG.warn is deprecated in Python 3 [1], so add hacking warn.
[1]https://docs.python.org/3/library/logging.html#logging.warning

Change-Id: I95aa121c2b11437a086d7f8bee25ffa956dd3e4f
This commit is contained in:
zhangguoqing 2016-03-18 20:29:18 +08:00
parent 559a4830dc
commit 2ef91a7e77
3 changed files with 30 additions and 0 deletions

0
heat/hacking/__init__.py Normal file
View File

29
heat/hacking/checks.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright (c) 2016 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def no_log_warn(logical_line):
"""Disallow 'LOG.warn('
https://bugs.launchpad.net/tempest/+bug/1508442
H001
"""
if logical_line.startswith('LOG.warn('):
yield(0, 'H001 Use LOG.warning() rather than LOG.warn()')
def factory(register):
register(no_log_warn)

View File

@ -68,6 +68,7 @@ max-complexity=20
[hacking]
import_exceptions = heat.common.i18n
local-check-factory = heat.hacking.checks.factory
[testenv:debug]
commands = oslo_debug_helper {posargs}