<p dir="ltr">Huge +1</p>
<div class="gmail_quote">On Jun 6, 2013 12:03 PM, "Gabriel Hurley" <<a href="mailto:Gabriel.Hurley@nebula.com">Gabriel.Hurley@nebula.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I suggest that we start with enabling H301 (one import per line), H303 (no wildcards), and H306 (alphabetical). I’m honestly surprised by how many violations
there are for that last one since we generally try to do that already. Obviously it’ll be a sizable patch to make this happen, but it’d be great to get it done. Please file a bug/blueprint for it.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks!<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p style="margin-left:29.25pt">
<u></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Gabriel<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Joe Gordon [mailto:<a href="mailto:joe.gordon0@gmail.com" target="_blank">joe.gordon0@gmail.com</a>]
<br>
<b>Sent:</b> Thursday, June 06, 2013 9:09 AM<br>
<b>To:</b> OpenStack Development Mailing List<br>
<b>Subject:</b> Re: [openstack-dev] [Horizon] HACKING.rst and import standards<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Although there is no HACKING.rst in Horizon, it does use the hacking plugin to flake8, just that the tests are all disabled.(<a href="https://github.com/openstack/horizon/blob/master/tox.ini#L40" target="_blank">https://github.com/openstack/horizon/blob/master/tox.ini#L40</a>).
You can start gating on one import per line (H301) and alphabetical order (H306), by fixing the issues and re-enabling the checks in tox.ini.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">'flake8 --statistics --select H3' shows the number off issues:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">194 H301 one import per line<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">16 H302 import only modules.'from collections import Sequence' does not import a module<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">7 H303 No wildcard (*) import.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">131 H304 No relative imports. 'from .views import UsageView' is a relative import<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">179 H306 imports not in alphabetical order (django.conf.urls.static.static, django.conf.settings)<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Thu, Jun 6, 2013 at 3:42 AM, Dolph Mathews <<a href="mailto:dolph.mathews@gmail.com" target="_blank">dolph.mathews@gmail.com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">+1; that's why alphabetical imports and one import per line!<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
On Thursday, June 6, 2013, Bhandaru, Malini K wrote:<u></u><u></u></p>
<p class="MsoNormal">+1<br>
<br>
Anything to avoid/ease manual merge. Good job describing problem Tatiana.<br>
Malini<br>
<br>
-----Original Message-----<br>
From: Tatiana V. Mazur [<a href="mailto:tmazur@mirantis.com" target="_blank">mailto:tmazur@mirantis.com</a>]<br>
Sent: Thursday, June 06, 2013 1:44 AM<br>
To: <a href="mailto:openstack-dev@lists.openstack.org" target="_blank">openstack-dev@lists.openstack.org</a><br>
Subject: [openstack-dev] [Horizon] HACKING.rst and import standards<br>
<br>
Hello!<br>
<br>
Recently I had to upload some patch sets and rebase some branches for this purpose. It appears that rebasing on changed master branch is not a trivial task. You know, when nearly each Horizon module includes a total mash of comma separated imports, that's really
not a trivial task.<br>
Problems start when you add some method from the same module in an existing import statement like here:<br>
<br>
from .views import (IndexView, CreateView, EditAttachmentsView, DetailView,<br>
CreateSnapshotView)<br>
<br>
or even here:<br>
<br>
from .views import IndexView<br>
from .views import AddPoolView, AddMemberView, AddMonitorView, AddVipView from .views import (UpdatePoolView, UpdateMemberView,<br>
UpdateVipView, UpdateMonitorView) from .views import PoolDetailsView, VipDetailsView from .views import MemberDetailsView, MonitorDetailsView from .views import AddPMAssociationView, DeletePMAssociationView<br>
<br>
All patch sets including this kind of changes can't be merged automatically. You have to rebase manually, just because of a few imports. I was wondering if there is a local Horizon standard for importing and tried to find it in HACKING.rst (like all standards
are described in other projects). And it appears there's no HACKING.rst in Horizon! That's why I have a few questions:<br>
<br>
1. Does it make sense to implement all imports uniformly like that is done in other projects?<br>
<br>
Something like this would be nice:<br>
<br>
from quantum.api.extensions import (<br>
ExtensionMiddleware,<br>
PluginAwareExtensionManager,<br>
)<br>
from quantum.common import config<br>
from quantum.extensions import (<br>
credential,<br>
qos,<br>
)<br>
<br>
Or just one import per line. That would solve merging problems and code would look much better.<br>
<br>
2. Does it make sense to add HACKING.rst in Horizon?<br>
<br>
I think yes. We could describe standards there and we would never get such kind of rebase and merge problems.<br>
<br>
What do you think about it? I could do it if you find it reasonable .<br>
<br>
<br>
Kind regards,<br>
Tatiana<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal"><span><span style="color:#888888">-- <u></u><u></u></span></span></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span><span style="color:#888888">-Dolph</span></span><span style="color:#888888"><br>
</span><br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div>