H701 Empty localization string

Bug #1351196 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Akihiro Motoki

Bug Description

Enabling E701 (Empty localization string) is useful.
In many cases, this type of _(xxx) does not work as expected.

Tags: i18n
Revision history for this message
Akihiro Motoki (amotoki) wrote :

At now, two errors are detected.

$ tox -e pep8
pep8 develop-inst-noop: /opt/stack/horizon
pep8 runtests: commands[0] | /bin/bash run_tests.sh -N --pep8
Running flake8 ...
./openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py:249:31: H701 Empty localization string
        common_rules = [(k, _(rules_dict[k]['name']))
                              ^
./horizon/exceptions.py:170:18: H701 Empty localization string
        return _(self.msg) % self.attrs
                 ^

For the first one, rules_dict comes from local_settings.py SECURITY_GROUP_RULES.
If 'name' in each entries of SECURITY_GROUP_RULES use _(xxx) properly, we don't need to use _() here.

For the second one, self.msg itself should be translatable.

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

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

Changed in horizon:
status: New → In Progress
Revision history for this message
Julie Pichon (jpichon) wrote :

Looks like quite a useful check!

tags: added: i18n
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/111204
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=5319c21e0e896c17174240941f755bd1334a18e1
Submitter: Jenkins
Branch: master

commit 5319c21e0e896c17174240941f755bd1334a18e1
Author: Akihiro Motoki <email address hidden>
Date: Fri Aug 1 17:09:25 2014 +0900

    Fix and enable H701 check "Empty localization string"

    Change-Id: Iae800f38cadb3d4f68ac4b70dd2d758d39a7f359
    Closes-Bug: #1351196

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
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.