← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1356687] Re: hacking check for jsonutils produces pep8 traceback

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => juno-3

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1356687

Title:
  hacking check for jsonutils produces pep8 traceback

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  the new jsonutils hacking check produces a pep8 traceback because it
  returns a set (column offset and error text) instead of an iterable
  (as logical line checks, like this check, should).

  commit 243879f5c51fc45f03491bcb78765945ddf76be8
  Change-Id: I86ed6cd3316dd4da5e1b10b36a3ddba3739316d3

  ===== 8< ===== TEST CASE ===== 8< =====
  $ echo 'foo = json.dumps(bar)' >nova/foobar.py
  $ flake8 -vv nova/foobar.py
  local configuration: in /home/dev/Desktop/nova-test
    ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,H803,H904
    exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
  checking nova/foobar.py
  foo = json.dumps(bar)
  Traceback (most recent call last):
    File "/home/dev/Desktop/nova-test/.venv/bin/flake8", line 9, in <module>
      load_entry_point('flake8==2.1.0', 'console_scripts', 'flake8')()
    File "/home/dev/Desktop/nova-test/.venv/local/lib/python2.7/site-packages/flake8/main.py", line 32, in main
      report = flake8_style.check_files()
    File "/home/dev/Desktop/nova-test/.venv/local/lib/python2.7/site-packages/pep8.py", line 1672, in check_files
      runner(path)
    File "/home/dev/Desktop/nova-test/.venv/local/lib/python2.7/site-packages/flake8/engine.py", line 73, in input_file
      return fchecker.check_all(expected=expected, line_offset=line_offset)
    File "/home/dev/Desktop/nova-test/.venv/local/lib/python2.7/site-packages/pep8.py", line 1436, in check_all
      self.check_logical()
    File "/home/dev/Desktop/nova-test/.venv/local/lib/python2.7/site-packages/pep8.py", line 1338, in check_logical
      for offset, text in self.run_check(check, argument_names) or ():
  TypeError: 'int' object is not iterable
  ===== 8< ===== TEST CASE ===== 8< =====

  
  diff --git a/nova/hacking/checks.py b/nova/hacking/checks.py
  index a1dd614..7fe7412 100644
  --- a/nova/hacking/checks.py
  +++ b/nova/hacking/checks.py
  @@ -300,7 +300,7 @@ def use_jsonutils(logical_line, filename):
           for f in json_funcs:
               pos = logical_line.find('json.%s' % f)
               if pos != -1:
  -                return (pos, msg % {'fun': f})
  +                yield (pos, msg % {'fun': f})
   
   
   def factory(register):
  ===== 8< ===== PATCH ===== 8< =====

  it's late, so tomorrow, if there hasn't been any activity on this,
  then i'll submit a patch for review.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1356687/+subscriptions


References