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:
parent
559a4830dc
commit
2ef91a7e77
0
heat/hacking/__init__.py
Normal file
0
heat/hacking/__init__.py
Normal file
29
heat/hacking/checks.py
Normal file
29
heat/hacking/checks.py
Normal 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)
|
1
tox.ini
1
tox.ini
@ -68,6 +68,7 @@ max-complexity=20
|
|||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions = heat.common.i18n
|
import_exceptions = heat.common.i18n
|
||||||
|
local-check-factory = heat.hacking.checks.factory
|
||||||
|
|
||||||
[testenv:debug]
|
[testenv:debug]
|
||||||
commands = oslo_debug_helper {posargs}
|
commands = oslo_debug_helper {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user