[openstack-dev] [nova] Proposal new hacking rules

Joe Gordon joe.gordon0 at gmail.com
Thu Nov 20 22:00:11 UTC 2014


On Thu, Nov 20, 2014 at 9:49 AM, Sahid Orentino Ferdjaoui <
sahid.ferdjaoui at redhat.com> wrote:

> This is something we can call nitpiking or low priority.
>

This all seems like nitpicking for very little value. I think there are
better things we can be focusing on instead of thinking of new ways to nit
pick. So I am -1 on all of these.


>
> I would like we introduce 3 new hacking rules to enforce the cohesion
> and consistency in the base code.
>
>
> Using boolean assertions
> ------------------------
>
> Some tests are written with equality assertions to validate boolean
> conditions which is something not clean:
>
>   assertFalse([]) asserts an empty list
>   assertEqual(False, []) asserts an empty list is equal to the boolean
>   value False which is something not correct.
>
> Some changes has been started here but still needs to be appreciated
> by community:
>
>  * https://review.openstack.org/#/c/133441/
>  * https://review.openstack.org/#/c/119366/
>
>
> Using same order of arguments in equality assertions
> ----------------------------------------------------
>
> Most of the code is written with assertEqual(Expected, Observed) but
> some part are still using the opposite. Even if they provide any real
> optimisation using the same convention help reviewing and keep a
> better consistency in the code.
>
>   assertEqual(Expected, Observed) OK
>   assertEqual(Observed, Expected) KO
>
> A change has been started here but still needs to be appreciated by
> community:
>
>  * https://review.openstack.org/#/c/119366/
>
>
> Using LOG.warn instead of LOG.warning
> -------------------------------------
>
> We can see many time reviewers -1ed a patch to ask developer to use
> 'warn' instead of 'warning'. This will provide no optimisation
> but let's finally have something clear about what we have to use.
>
>   LOG.warning: 74
>   LOG.warn:    319
>
> We probably want to use 'warn'
>
> Nothing has been started from what I know.
>
>
> Thanks,
> s.
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141120/6d7951d7/attachment.html>


More information about the OpenStack-dev mailing list