)]}'
{"nova/hacking/checks.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"403c2d664c1bce1b9be8b1351c3625cd71ee28d9","unresolved":false,"context_lines":[{"line_number":98,"context_line":"    r\"(.)*LOG\\.(.*)\\(.*(context\u003d[_a-zA-Z0-9].*)+.*\\)\")"},{"line_number":99,"context_line":"return_not_followed_by_space \u003d re.compile(r\"^\\s*return(?:\\(|{|\\\"|\u0027|#).*$\")"},{"line_number":100,"context_line":"uuid4_re \u003d re.compile(r\"uuid4\\(\\)($|[^\\.]|\\.hex)\")"},{"line_number":101,"context_line":"redundant_import_alias_re \u003d re.compile(r\".*import (.+) as \\1$\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"class BaseASTChecker(ast.NodeVisitor):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_85652848","line":101,"updated":"2018-02-14 17:09:44.000000000","message":"Does it make any sense to anchor this to start, zero or more whitespace, import?","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"370f2ea5a4287768f5e56ef67d44d51a5c405bae","unresolved":false,"context_lines":[{"line_number":98,"context_line":"    r\"(.)*LOG\\.(.*)\\(.*(context\u003d[_a-zA-Z0-9].*)+.*\\)\")"},{"line_number":99,"context_line":"return_not_followed_by_space \u003d re.compile(r\"^\\s*return(?:\\(|{|\\\"|\u0027|#).*$\")"},{"line_number":100,"context_line":"uuid4_re \u003d re.compile(r\"uuid4\\(\\)($|[^\\.]|\\.hex)\")"},{"line_number":101,"context_line":"redundant_import_alias_re \u003d re.compile(r\".*import (.+) as \\1$\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"class BaseASTChecker(ast.NodeVisitor):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_d602040c","line":101,"in_reply_to":"3fa0c359_85652848","updated":"2018-02-14 18:24:44.000000000","message":"you\u0027d have to also allow for \"from ... \" cases","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"370f2ea5a4287768f5e56ef67d44d51a5c405bae","unresolved":false,"context_lines":[{"line_number":811,"context_line":"    N359"},{"line_number":812,"context_line":"    \"\"\""},{"line_number":813,"context_line":"    if re.match(redundant_import_alias_re, logical_line):"},{"line_number":814,"context_line":"        yield(0, \"N359: No redundant import alias.\")"},{"line_number":815,"context_line":""},{"line_number":816,"context_line":""},{"line_number":817,"context_line":"def factory(register):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_9187a662","line":814,"range":{"start_line":814,"start_character":24,"end_line":814,"end_character":50},"updated":"2018-02-14 18:24:44.000000000","message":"\"Import alias should not be redundant\" ?","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":16710,"name":"Eric Berglund","email":"esberglu@us.ibm.com","username":"esberglu"},"change_message_id":"e27473a740f218fd6ef604de179a9cb36a398717","unresolved":false,"context_lines":[{"line_number":811,"context_line":"    N359"},{"line_number":812,"context_line":"    \"\"\""},{"line_number":813,"context_line":"    if re.match(redundant_import_alias_re, logical_line):"},{"line_number":814,"context_line":"        yield(0, \"N359: No redundant import alias.\")"},{"line_number":815,"context_line":""},{"line_number":816,"context_line":""},{"line_number":817,"context_line":"def factory(register):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_523c44c7","line":814,"range":{"start_line":814,"start_character":24,"end_line":814,"end_character":50},"in_reply_to":"3fa0c359_9187a662","updated":"2018-02-21 16:44:28.000000000","message":"Done","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"055ccba60874d2c10622b05602ee89cf53b5dde1","unresolved":false,"context_lines":[{"line_number":98,"context_line":"    r\"(.)*LOG\\.(.*)\\(.*(context\u003d[_a-zA-Z0-9].*)+.*\\)\")"},{"line_number":99,"context_line":"return_not_followed_by_space \u003d re.compile(r\"^\\s*return(?:\\(|{|\\\"|\u0027|#).*$\")"},{"line_number":100,"context_line":"uuid4_re \u003d re.compile(r\"uuid4\\(\\)($|[^\\.]|\\.hex)\")"},{"line_number":101,"context_line":"redundant_import_alias_re \u003d re.compile(r\".*import(\\s|.*\\.)(.+) as \\2$\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"class BaseASTChecker(ast.NodeVisitor):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_ca0ba227","line":101,"range":{"start_line":101,"start_character":50,"end_line":101,"end_character":57},"updated":"2018-02-21 18:41:20.000000000","message":"I don\u0027t get what you\u0027re trying to do here.  This says:\n\n a whitespace character\n or\n any string ending with a period\n\nI would think we always want whitespace after the \u0027import\u0027 keyword.  Otherwise we may incorrectly match things like importutils.","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"055ccba60874d2c10622b05602ee89cf53b5dde1","unresolved":false,"context_lines":[{"line_number":98,"context_line":"    r\"(.)*LOG\\.(.*)\\(.*(context\u003d[_a-zA-Z0-9].*)+.*\\)\")"},{"line_number":99,"context_line":"return_not_followed_by_space \u003d re.compile(r\"^\\s*return(?:\\(|{|\\\"|\u0027|#).*$\")"},{"line_number":100,"context_line":"uuid4_re \u003d re.compile(r\"uuid4\\(\\)($|[^\\.]|\\.hex)\")"},{"line_number":101,"context_line":"redundant_import_alias_re \u003d re.compile(r\".*import(\\s|.*\\.)(.+) as \\2$\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"class BaseASTChecker(ast.NodeVisitor):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_aa7736d4","line":101,"range":{"start_line":101,"start_character":59,"end_line":101,"end_character":61},"updated":"2018-02-21 18:41:20.000000000","message":"Using .+ here (instead of [^.]+) means you will hypothetically also forbid:\n\nimport foo.bar.baz as bar.baz\n\nI don\u0027t know if that\u0027s good or bad.","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"055ccba60874d2c10622b05602ee89cf53b5dde1","unresolved":false,"context_lines":[{"line_number":813,"context_line":""},{"line_number":814,"context_line":"    N359"},{"line_number":815,"context_line":"    \"\"\""},{"line_number":816,"context_line":"    if re.match(redundant_import_alias_re, logical_line):"},{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_5023c0a7","line":816,"range":{"start_line":816,"start_character":10,"end_line":816,"end_character":15},"updated":"2018-02-21 18:41:20.000000000","message":"re.match has an implicit starting anchor; re.search doesn\u0027t.  If you use re.search, you don\u0027t need the initial .* in your pattern.","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":16710,"name":"Eric Berglund","email":"esberglu@us.ibm.com","username":"esberglu"},"change_message_id":"cfa57ac452c1c98380dc8918fdfd02d134ab9523","unresolved":false,"context_lines":[{"line_number":813,"context_line":""},{"line_number":814,"context_line":"    N359"},{"line_number":815,"context_line":"    \"\"\""},{"line_number":816,"context_line":"    if re.match(redundant_import_alias_re, logical_line):"},{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_36e62cb2","line":816,"range":{"start_line":816,"start_character":10,"end_line":816,"end_character":15},"in_reply_to":"3fa0c359_5023c0a7","updated":"2018-02-21 20:37:42.000000000","message":"Done","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"055ccba60874d2c10622b05602ee89cf53b5dde1","unresolved":false,"context_lines":[{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""},{"line_number":820,"context_line":"def factory(register):"},{"line_number":821,"context_line":"    register(import_no_db_in_virt)"},{"line_number":822,"context_line":"    register(no_db_session_in_public_api)"},{"line_number":823,"context_line":"    register(use_timeutils_utcnow)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_7076fca6","line":820,"updated":"2018-02-21 18:41:20.000000000","message":"So I\u0027m thinking:\n\n r\"import .*(.+) as \\1\"\n\nTested it locally and it seems to work okay for the test case you wrote up, anyway :)","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":16710,"name":"Eric Berglund","email":"esberglu@us.ibm.com","username":"esberglu"},"change_message_id":"cfa57ac452c1c98380dc8918fdfd02d134ab9523","unresolved":false,"context_lines":[{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""},{"line_number":820,"context_line":"def factory(register):"},{"line_number":821,"context_line":"    register(import_no_db_in_virt)"},{"line_number":822,"context_line":"    register(no_db_session_in_public_api)"},{"line_number":823,"context_line":"    register(use_timeutils_utcnow)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa0c359_76f03468","line":820,"in_reply_to":"3fa0c359_7076fca6","updated":"2018-02-21 20:37:42.000000000","message":"This will overmatch on things like\n\nimport abc as bc\n\nLet me know what you think of the regex in the new changeset.","commit_id":"ccef523124cab687db25c8fb155451d219c11081"},{"author":{"_account_id":7634,"name":"Takashi Natsume","email":"takanattie@gmail.com","username":"natsumet"},"change_message_id":"7dbc4a71bc78e7f8ff09e0c9766e98a2bab92fb5","unresolved":false,"context_lines":[{"line_number":814,"context_line":"    N359"},{"line_number":815,"context_line":"    \"\"\""},{"line_number":816,"context_line":"    if re.search(redundant_import_alias_re, logical_line):"},{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""},{"line_number":820,"context_line":"def factory(register):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_fa77fbd2","line":817,"range":{"start_line":817,"start_character":8,"end_line":817,"end_character":14},"updated":"2018-02-26 10:37:54.000000000","message":"nit: Add a white space between \u0027yield\u0027 and \u0027(\u0027 like line 801.","commit_id":"61d4a00d72b523f1085490453c1ed9d6bf0f4c97"},{"author":{"_account_id":16710,"name":"Eric Berglund","email":"esberglu@us.ibm.com","username":"esberglu"},"change_message_id":"a753a551cd85c8a73646c363e7ab5d7cd0ac396c","unresolved":false,"context_lines":[{"line_number":814,"context_line":"    N359"},{"line_number":815,"context_line":"    \"\"\""},{"line_number":816,"context_line":"    if re.search(redundant_import_alias_re, logical_line):"},{"line_number":817,"context_line":"        yield(0, \"N359: Import alias should not be redundant.\")"},{"line_number":818,"context_line":""},{"line_number":819,"context_line":""},{"line_number":820,"context_line":"def factory(register):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa0c359_29b51f7e","line":817,"range":{"start_line":817,"start_character":8,"end_line":817,"end_character":14},"in_reply_to":"3fa0c359_fa77fbd2","updated":"2018-02-26 14:33:51.000000000","message":"Done","commit_id":"61d4a00d72b523f1085490453c1ed9d6bf0f4c97"}],"nova/tests/unit/test_hacking.py":[{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"370f2ea5a4287768f5e56ef67d44d51a5c405bae","unresolved":false,"context_lines":[{"line_number":784,"context_line":"            \"return (int(\u002740\u0027) + 2)\"))))"},{"line_number":785,"context_line":""},{"line_number":786,"context_line":"    def test_no_redundant_import_alias(self):"},{"line_number":787,"context_line":"        code \u003d \"from package import module as module\""},{"line_number":788,"context_line":"        errors \u003d [(1, 0, \u0027N359\u0027)]"},{"line_number":789,"context_line":"        self._assert_has_errors(code, checks.no_redundant_import_alias,"},{"line_number":790,"context_line":"                                expected_errors\u003derrors)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_71745a9d","line":787,"updated":"2018-02-14 18:24:44.000000000","message":"let\u0027s also test \"import module as module\" vs. \"import module\".","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":16710,"name":"Eric Berglund","email":"esberglu@us.ibm.com","username":"esberglu"},"change_message_id":"e27473a740f218fd6ef604de179a9cb36a398717","unresolved":false,"context_lines":[{"line_number":784,"context_line":"            \"return (int(\u002740\u0027) + 2)\"))))"},{"line_number":785,"context_line":""},{"line_number":786,"context_line":"    def test_no_redundant_import_alias(self):"},{"line_number":787,"context_line":"        code \u003d \"from package import module as module\""},{"line_number":788,"context_line":"        errors \u003d [(1, 0, \u0027N359\u0027)]"},{"line_number":789,"context_line":"        self._assert_has_errors(code, checks.no_redundant_import_alias,"},{"line_number":790,"context_line":"                                expected_errors\u003derrors)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_bb0a431d","line":787,"in_reply_to":"3fa0c359_71745a9d","updated":"2018-02-21 16:44:28.000000000","message":"Done","commit_id":"2e28b5a871941b037ca30424d224852449522184"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"48ce9b73993013ea8d3326997a539b6d6df8ede6","unresolved":false,"context_lines":[{"line_number":782,"context_line":"            \"return \u0027 some string \u0027\"))))"},{"line_number":783,"context_line":"        self.assertEqual(0, len(list(checks.return_followed_by_space("},{"line_number":784,"context_line":"            \"return (int(\u002740\u0027) + 2)\"))))"},{"line_number":785,"context_line":""},{"line_number":786,"context_line":"    def test_no_redundant_import_alias(self):"},{"line_number":787,"context_line":"        code \u003d \"\"\""},{"line_number":788,"context_line":"                  from x import y as y"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa0c359_24259609","line":785,"updated":"2018-02-21 22:02:17.000000000","message":"FYI, I added a couple of extras here to further confirm your regex:\n\n    def test_no_redundant_import_alias(self):\n        code \u003d \"\"\"\n                  from x import y as y\n                  import x as x\n                  import x.y.z as z\n                  import x.y.z as y.z\n               \"\"\"\n        errors \u003d [(x + 1, 0, \u0027N359\u0027) for x in range(4)]\n        self._assert_has_errors(code, checks.no_redundant_import_alias,\n                                expected_errors\u003derrors)\n        code \u003d \"\"\"\n                  from x import y\n                  import x\n                  from x.y import z\n                  from a import bcd as cd\n                  import ab.cd.efg as fg\n                  import ab.cd.efg as d.efg\n               \"\"\"\n        self._assert_has_no_errors(code, checks.no_redundant_import_alias)","commit_id":"27c5f658a5cc9430ed0fe37f3f1e072e03dd3698"}]}
