Improve hacking rule to avoid author markers
The case with the tag "moduleauthor" is not handled when checking to avoid author makers. Also fix the position when the tag Author is used. Change-Id: I17b07b9f5448f9cbb4c5705f655c5392316a6239 Closes-Bug: #1314176
This commit is contained in:
parent
2acd7fbe85
commit
18938d283c
@ -19,5 +19,4 @@
|
|||||||
.. automodule:: nova.api.metadata
|
.. automodule:: nova.api.metadata
|
||||||
:platform: Unix
|
:platform: Unix
|
||||||
:synopsis: Metadata Server for Nova
|
:synopsis: Metadata Server for Nova
|
||||||
.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
|
|
||||||
"""
|
"""
|
||||||
|
@ -19,5 +19,4 @@
|
|||||||
:platform: Unix
|
:platform: Unix
|
||||||
:synopsis: Wrapper around console proxies such as xvp to set up
|
:synopsis: Wrapper around console proxies such as xvp to set up
|
||||||
multitenant VM console access
|
multitenant VM console access
|
||||||
.. moduleauthor:: Monsyne Dragon <mdragon@rackspace.com>
|
|
||||||
"""
|
"""
|
||||||
|
@ -37,7 +37,8 @@ virt_import_re = re.compile(
|
|||||||
r"^\s*(?:import|from) nova\.(?:tests\.)?virt\.(\w+)")
|
r"^\s*(?:import|from) nova\.(?:tests\.)?virt\.(\w+)")
|
||||||
virt_config_re = re.compile(
|
virt_config_re = re.compile(
|
||||||
r"CONF\.import_opt\('.*?', 'nova\.virt\.(\w+)('|.)")
|
r"CONF\.import_opt\('.*?', 'nova\.virt\.(\w+)('|.)")
|
||||||
author_tag_re = re.compile("^\s*#\s*@?(a|A)uthor:")
|
author_tag_re = (re.compile("^\s*#\s*@?(a|A)uthor:"),
|
||||||
|
re.compile("^\.\.\s+moduleauthor::"))
|
||||||
asse_trueinst_re = re.compile(
|
asse_trueinst_re = re.compile(
|
||||||
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
||||||
"(\w|\.|\'|\"|\[|\])+\)\)")
|
"(\w|\.|\'|\"|\[|\])+\)\)")
|
||||||
@ -158,9 +159,13 @@ def no_vi_headers(physical_line, line_number, lines):
|
|||||||
|
|
||||||
|
|
||||||
def no_author_tags(physical_line):
|
def no_author_tags(physical_line):
|
||||||
if author_tag_re.match(physical_line):
|
for regex in author_tag_re:
|
||||||
pos = physical_line.find('author')
|
if regex.match(physical_line):
|
||||||
return pos, "N315: Don't use author tags"
|
physical_line = physical_line.lower()
|
||||||
|
pos = physical_line.find('moduleauthor')
|
||||||
|
if pos < 0:
|
||||||
|
pos = physical_line.find('author')
|
||||||
|
return pos, "N315: Don't use author tags"
|
||||||
|
|
||||||
|
|
||||||
def assert_true_instance(logical_line):
|
def assert_true_instance(logical_line):
|
||||||
|
@ -19,7 +19,4 @@
|
|||||||
.. automodule:: nova.scheduler
|
.. automodule:: nova.scheduler
|
||||||
:platform: Unix
|
:platform: Unix
|
||||||
:synopsis: Module that picks a compute node to run a VM instance.
|
:synopsis: Module that picks a compute node to run a VM instance.
|
||||||
.. moduleauthor:: Sandy Walsh <sandy.walsh@rackspace.com>
|
|
||||||
.. moduleauthor:: Ed Leafe <ed@leafe.com>
|
|
||||||
.. moduleauthor:: Chris Behrens <cbehrens@codestud.com>
|
|
||||||
"""
|
"""
|
||||||
|
@ -54,7 +54,11 @@ class HackingTestCase(test.NoDBTestCase):
|
|||||||
self.assertTrue(checks.no_author_tags("# @author: jogo"))
|
self.assertTrue(checks.no_author_tags("# @author: jogo"))
|
||||||
self.assertTrue(checks.no_author_tags("# @Author: jogo"))
|
self.assertTrue(checks.no_author_tags("# @Author: jogo"))
|
||||||
self.assertTrue(checks.no_author_tags("# Author: jogo"))
|
self.assertTrue(checks.no_author_tags("# Author: jogo"))
|
||||||
|
self.assertTrue(checks.no_author_tags(".. moduleauthor:: jogo"))
|
||||||
self.assertFalse(checks.no_author_tags("# authorization of this"))
|
self.assertFalse(checks.no_author_tags("# authorization of this"))
|
||||||
|
self.assertEqual(2, checks.no_author_tags("# author: jogo")[0])
|
||||||
|
self.assertEqual(2, checks.no_author_tags("# Author: jogo")[0])
|
||||||
|
self.assertEqual(3, checks.no_author_tags(".. moduleauthor:: jogo")[0])
|
||||||
|
|
||||||
def test_assert_true_instance(self):
|
def test_assert_true_instance(self):
|
||||||
self.assertEqual(len(list(checks.assert_true_instance(
|
self.assertEqual(len(list(checks.assert_true_instance(
|
||||||
|
Loading…
Reference in New Issue
Block a user