hacking/flake8 skips most xenapi plugins

Bug #1302831 reported by Johannes Erdfelt on 2014-04-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Stephen Finucane

Bug Description

It appears to be because the plugins themselves don't have a filename that ends in .py so they get skipped. Only the few files in there that end .py are being checked.

Tracy Jones (tjones-i) on 2014-04-08
tags: added: xenserver
John Garbutt (johngarbutt) wrote :

Arg, this keeps breaking...

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Michael Davies (mrda) on 2014-06-12
Changed in nova:
assignee: nobody → Michael Davies (mrda)

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

Changed in nova:
status: Confirmed → In Progress

Change abandoned by Michael Davies (<email address hidden>) on branch: master
Review: https://review.openstack.org/99588
Reason: So with more testing, this approach clearly doesn't work :(

Michael Davies (mrda) wrote :

Specifying a path to check is orthogonal to specifying a filename match.

i.e. filename = *.py,*plugins/xenserver*

This specified that all *.py files will be checked from the <root> of the tox command downwards, and all *.py files in a directory that matches *plugins/xenserver*.

I can't seem to get *plugins/xenserver* to match all files under that directory. Or more specifically, all files under plugins/xenserver/xenapi/etc/xapi.d/plugins

Consequently I'm unassigning in case anyone else has better ideas.

The only other option, is to rename all those files in that directory to have a .py suffix. That'd work for sure.

Changed in nova:
status: In Progress → Confirmed
assignee: Michael Davies (mrda) → nobody
Sean Dague (sdague) wrote :

flake8 doesn't do path matching, it does a walk. So you can only do file level matching. I did look at this code recently for just this issue.

Changed in nova:
assignee: nobody → Stephen Finucane (sfinucan)

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

Changed in nova:
status: Confirmed → In Progress

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

Reviewed: https://review.openstack.org/289490
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=79805827bb968d2bd1698c6ae874710ddc8c6910
Submitter: Jenkins
Branch: master

commit 79805827bb968d2bd1698c6ae874710ddc8c6910
Author: Stephen Finucane <email address hidden>
Date: Mon Mar 7 17:46:54 2016 +0000

    plugins/xenserver: Resolve PEP8 issues

    Before enabling PEP8 checks for these files, the actual PEP8 issues
    need to be resolved. There are a number of "types" of issues that need
    to be fixed:

    * E112 expected an indented block
    * E241 multiple spaces after ','
    * E265 block comment should start with '# '
    * E302 expected 2 blank lines, found 1
    * H102 Apache 2.0 license header not found
    * H237 module module is removed in Python 3
    * H303 No wildcard (*) import.
    * H404 multi line docstring should start without a leading new line
    * H231 Python 3.x incompatible 'except x,y:' construct
    * F403 from module import *' used; unable to detect undefined names
    * F841 local variable 'name' is assigned to but never used
    * N344 Use six.iteritems() instead of dict.iteritems().

    The fixes for the above are all pretty self-explanatory, but there is
    one exception. The 'N344' issues are not ignorable due to how the
    "hacking" check is implemented. Rather than ignoring them, skip the
    issue altogether by replacing 'iteritems' with 'items'. The difference
    in memory usage that this incurs should not be noticable.

    Change-Id: Ie26e3daca3b408c9ea43613bcb9996618b9abc69
    Partial-Bug: #1302831

Reviewed: https://review.openstack.org/355574
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ac9b37e619e85cf1c09a983b2698be6fe44c6c34
Submitter: Jenkins
Branch: master

commit ac9b37e619e85cf1c09a983b2698be6fe44c6c34
Author: Stephen Finucane <email address hidden>
Date: Mon Aug 15 16:54:30 2016 +0100

    plugins/xenserver: Resolve PEP8 issues

    Some files have regressed since '798058' ensured PEP8 compliance.
    Correct these regressions in preparation for enabled PEP8 checks.

    Change-Id: I2d0bae469673e4b5e2238978a7ba63f6bfe0358a
    Partial-Bug: #1302831

Reviewed: https://review.openstack.org/289431
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6bb1fd776feb7efd36a8c622ded37b67a21754cc
Submitter: Jenkins
Branch: master

commit 6bb1fd776feb7efd36a8c622ded37b67a21754cc
Author: Stephen Finucane <email address hidden>
Date: Mon Mar 7 16:12:17 2016 +0000

    plugins/xenserver: Add '.py' extension

    All Python files, except executables, should have a '.py' extension.
    This wasn't being done for files in the 'plugins/xenserver' folder,
    likely because it seems unnatural to call a "plugin" with a file

    Begin working towards a resolution for this by renaming all files to
    include a '.py' extension. To avoid forcing operators to upgrade the
    Nova service and per-host plugins at the same time, continue to
    reference the old, non-'.py' filenames, using symlinks to ensure the
    references continue to work. Once Ocata has been released, these
    symlinks can be removed, the API version updated and the reference
    updated to include the '.py' extension.

    Change-Id: Icf4cf2424c15276a6c01778fb92f76bbdc9b2068
    Closes-bug: #1302831

Changed in nova:
status: In Progress → Fix Released

This issue was fixed in the openstack/nova development milestone.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers