Some Python files do not specify the file encoding

Bug #1325193 reported by Martin Geisler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Won't Fix
Low
Martin Geisler
python-ironicclient
Won't Fix
Low
John L. Villalovos

Bug Description

While not strictly necessary for files containing only ASCII characters, adding a line with "coding: utf-8" can guard against future SyntaxError's in case someone inserts a Unicode literal.

Currently, some files have such a header and some files don't.

Changed in python-ironicclient:
assignee: nobody → Martin Geisler (mgeisler)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

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

Changed in ironic:
assignee: nobody → Martin Geisler (mgeisler)
status: New → In Progress
Revision history for this message
Martin Geisler (mgeisler) wrote :

For python-ironicclient, please see https://review.openstack.org/96109/.

Dmitry Tantsur (divius)
Changed in python-ironicclient:
importance: Undecided → Low
Changed in ironic:
importance: Undecided → Low
Revision history for this message
aeva black (tenbrae) wrote :

Have a look at other projects (eg, nova and swift). There are almost no files with this heading.

Do we really need to add this to every file? Or just clean up a few files with errant non-ASCII characters?

Revision history for this message
Martin Geisler (mgeisler) wrote :

I can add or remove the lines easily, so please let me know what you agree upon :) In tuskar and ceilometer, I had patches merged that removed the lines instead.

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

Reviewed: https://review.openstack.org/96109
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=af741ec2236619880fa902d68aef4a6ae6cef534
Submitter: Jenkins
Branch: master

commit af741ec2236619880fa902d68aef4a6ae6cef534
Author: Martin Geisler <email address hidden>
Date: Wed May 28 11:02:12 2014 +0200

    Add UTF-8 coding lines to all Python files

    While not strictly necessary for files containing only ASCII
    characters, adding a line with "coding: utf-8" can guard against
    future SyntaxError's in case someone inserts a Unicode literal.

    This commit adds such lines to all .py files. The syntax used by this
    commit works with Python (of course). It also works with Emacs, which
    will recognize the special "-*-" marker and use the "coding" variable
    to correctly decode the file, even in an environment where UTF-8 is
    not the default file encoding.

    Existing coding lines were normalized to match the new lines added.

    Partial-bug: #1325193
    Change-Id: I58bf93fea711fd25890356a397e594bd820c99e3

Revision history for this message
John Stafford (john-stafford) wrote :

Can this bug be closed?

Revision history for this message
Ruby Loo (rloo) wrote :

Hi Martin, in our weekly Ironic meeting today, we discussed this bug and voted not to add the encoding line to all the files [1].

[1] http://eavesdrop.openstack.org/meetings/ironic/2015/ironic.2015-04-20-17.00.html

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

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

Changed in python-ironicclient:
assignee: Martin Geisler (mgeisler) → John L. Villalovos (happycamp)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

Reviewed: https://review.openstack.org/175534
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=2df670cf3045c2c430eaaac6f48919d6d1586afc
Submitter: Jenkins
Branch: master

commit 2df670cf3045c2c430eaaac6f48919d6d1586afc
Author: John L. Villalovos <email address hidden>
Date: Mon Apr 20 11:49:38 2015 -0700

    Remove unneeded 'utf-8' coding lines

    This is basically a revert of commit:
      af741ec2236619880fa902d68aef4a6ae6cef534

    It was decided that only files that need to have the line:
      # -*- coding: utf-8 -*-
    Should have the line[1] as a general principle

    This patch removes the 'utf-8' coding line from files that consist
    entirely of ASCII characters.

    [1]
    http://eavesdrop.openstack.org/meetings/ironic/2015/ironic.2015-04-20-17.00.html

    Partial-bug: #1325193
    Change-Id: I88c1c37f7b580aa805eae9d4a1e66d33302a325f

Changed in python-ironicclient:
status: In Progress → Won't Fix
Changed in ironic:
status: In Progress → Invalid
status: Invalid → Won't Fix
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ironic (master)

Change abandoned by Ruby Loo (<email address hidden>) on branch: master
Review: https://review.openstack.org/97027
Reason: See comments. We don't want to add utf-8 lines to every file.

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.