hacking/flake8 skips most xenapi plugins

Bug #1302831 reported by Johannes Erdfelt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
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.

Tags: xenserver
Tracy Jones (tjones-i)
tags: added: xenserver
Revision history for this message
John Garbutt (johngarbutt) wrote :

Arg, this keeps breaking...

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Michael Davies (mrda)
Changed in nova:
assignee: nobody → Michael Davies (mrda)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

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 :(

Revision history for this message
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
Revision history for this message
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)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

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

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

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

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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
    extension.

    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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b1

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

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.