On 12/09/2014 12:20 PM, Kevin L. Mitchell wrote:
> On Tue, 2014-12-09 at 12:05 -0500, Sean Dague wrote:
>>> I agree that dropping H302 and the grouping checks makes sense.  I
>> think
>>> we should keep the H301, H303, H304, and the basic ordering checks,
>>> however; it doesn't seem to me that these would be that difficult to
>>> implement or maintain.
>>
>> Well, be careful what you think is easy -
>> https://github.com/openstack-dev/hacking/blob/master/hacking/checks/imports.py
>> :)
> 
> So, hacking_import_rules() is very complex.  However, it implements H302
> as well as H301, H303, and H304.  I feel it can be simplified to just a
> textual match rule if we remove the H302 implementation: H301 just needs
> to exclude imports with ',', H303 needs to exclude imports with '*', and
> H304 is already implemented as a regular expression match.  It looks
> like the basic ordering check I was referring to is H306, which isn't
> all that complicated.  It seems like the rest of the code is related to
> the checks which I just agreed should be dropped :)  Am I missing
> anything?

Yes, the following fails H305 and H306.

nova/tests/fixtures.py

"""Fixtures for Nova tests."""
from __future__ import absolute_import

import gettext
import logging
import os
import uuid

import fixtures
from oslo.config import cfg

from nova.db import migration
from nova.db.sqlalchemy import api as session
from nova import service


Because name normalization is hard (fixtures is normalized to
nova.tests.fixtures so H305 thinks it should be in group 3, and H306
thinks it should be after oslo.config import cfg).

To sort things you have to normalize them.

        -Sean

-- 
Sean Dague
http://dague.net

_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to