The output of "run_tests.sh -p" is hard to understand when H803 error

Bug #1229342 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Akihiro Motoki

Bug Description

When there is an error H803 (git commit title should not end with period), the output of "run_tests.sh -p" is difficult to understand.

ubuntu@ostack02:~/horizon (bug/1226868)$ ./run_tests.sh -p
Checking environment.
Environment is up to date.
Running flake8 ...
Traceback (most recent call last):
  File "/opt/stack/horizon/.venv/bin/flake8", line 9, in <module>
    load_entry_point('flake8==2.0', 'console_scripts', 'flake8')()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/flake8/main.py", line 29, in main
    report = flake8_style.check_files()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/pep8.py", line 1604, in check_files
    self.input_dir(path)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/pep8.py", line 1640, in input_dir
    runner(os.path.join(root, filename))
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/flake8/engine.py", line 69, in input_file
    return fchecker.check_all(expected=expected, line_offset=line_offset)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/pep8.py", line 1348, in check_all
    self.check_ast()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/pep8.py", line 1329, in check_ast
    if not noqa(self.lines[lineno - 1]):
IndexError: list index out of range

After removing $included_dirs from flake8 arguments, a user-friendly message is printed.
We can exclude files by tox.ini, so $included_dirs is not necessarily required.

ubuntu@ostack02:~/horizon (bug/1226868)$ source .venv/bin/activate
(.venv)ubuntu@ostack02:~/horizon (bug/1226868)$ DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings flake8
./manage.py:1:1: H803 git commit title ('Add support for loadbalancer providers.') should not end with period

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/48174

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/48174
Committed: http://github.com/openstack/horizon/commit/a60ae8e3902da0f4ebb7db78220789c66a700cac
Submitter: Jenkins
Branch: master

commit a60ae8e3902da0f4ebb7db78220789c66a700cac
Author: Akihiro MOTOKI <email address hidden>
Date: Wed Sep 25 12:12:27 2013 +0900

    Make some PEP8 understandable in run_tests.sh -p

    Previously the error message is hard to understand when
    some hacking violation such as H803 is detected.
    It can be avoided by removing $included_dir from flake8 argument.
    As excluded dir is defined in tox.ini, $inlucded_dir is not needed.

    Change-Id: I8d1d48fa6feba74ffcec27bf971394b9db727945
    Closes-Bug: #1229342

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
Julie Pichon (jpichon) wrote :

I tested the patch with several of the issues that were listed in bug 1194180 and this resolves them all. Thank you so much for tracking this down! It was making debugging pep8 errors very hard, particularly for newcomers.

Thierry Carrez (ttx)
Changed in horizon:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.