Correct Hacking rule code
The hacking rule error code should be start with 'M', which stands for Magnum. PS: Error number begins with M301 Closes-Bug: #1465895 Change-Id: Ie9565c4a700a1bf85eed8c5db87a8c4012f5254b
This commit is contained in:
parent
1916f672a1
commit
f67e67ec9a
|
@ -1,11 +1,11 @@
|
|||
magnum Style Commandments
|
||||
Magnum Style Commandments
|
||||
=========================
|
||||
|
||||
- Step 1: Read the OpenStack Style Commandments
|
||||
http://docs.openstack.org/developer/hacking/
|
||||
- Step 2: Read on
|
||||
|
||||
magnum Specific Commandments
|
||||
Magnum Specific Commandments
|
||||
---------------------------
|
||||
|
||||
- [N301] policy.enforce_wsgi decorator must be the first decorator on a method.
|
||||
- [M301] policy.enforce_wsgi decorator must be the first decorator on a method.
|
||||
|
|
|
@ -20,10 +20,11 @@ Guidelines for writing new hacking checks
|
|||
|
||||
- Use only for Magnum specific tests. OpenStack general tests
|
||||
should be submitted to the common 'hacking' module.
|
||||
- Pick numbers in the range N3xx. Find the current test with
|
||||
- Pick numbers in the range M3xx. Find the current test with
|
||||
the highest allocated number and then pick the next value.
|
||||
If nova has an N3xx code for that test, use the same number.
|
||||
- Keep the test method code in the source file ordered based
|
||||
on the N3xx value.
|
||||
on the M3xx value.
|
||||
- List the new rule in the top level HACKING.rst file
|
||||
- Add test cases for each new rule to magnum/tests/unit/test_hacking.py
|
||||
|
||||
|
@ -36,7 +37,7 @@ decorator_re = re.compile(r"@.*")
|
|||
def check_policy_enforce_decorator(logical_line,
|
||||
previous_logical, blank_before,
|
||||
filename):
|
||||
msg = ("N301: the policy.enforce_wsgi decorator must be the "
|
||||
msg = ("M301: the policy.enforce_wsgi decorator must be the "
|
||||
"first decorator on a method.")
|
||||
if (blank_before == 0 and re.match(enforce_re, logical_line)
|
||||
and re.match(decorator_re, previous_logical)):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2915 Intel, Inc.
|
||||
# Copyright 2015 Intel, Inc.
|
||||
#
|
||||
# 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
|
||||
|
@ -82,4 +82,4 @@ class HackingTestCase(base.TestCase):
|
|||
pass
|
||||
"""
|
||||
self._assert_has_errors(code, checks.check_policy_enforce_decorator,
|
||||
expected_errors=[(2, 0, "N301")])
|
||||
expected_errors=[(2, 0, "M301")])
|
||||
|
|
Loading…
Reference in New Issue