Skip to content

E501: Combining diacritics counted against line length #856

Open

Description

@reynoldsnlp

It looks like unicode combining diacritics are counted as full characters, which causes E501 to fire, even when it is visually less than 79 characters:

text = ['ся́ду', 'твёрдый', 'ю́бкой', 'ба́юшки', 'опя́ть', 'съе́сть', 'жи́ть', 'éли']
a = 'а́́́́́́́́́́́́́́́́́́́'

It seems to me that combining characters should be excluded from the count.

Activity

  1. sigmavirus24 commented on Mar 23, 2019

    @sigmavirus24
    Member

    Which version of python is pycodestyle running on and which version of pycodestyle are you using?

  2. reynoldsnlp commented on Mar 27, 2019

    @reynoldsnlp
    Author

    Python 3.6.7
    pycodestyle==2.3.1

  3. asottile commented on Mar 27, 2019

    @asottile
    Member

    shouldn't be too hard to implement using unicodedata:

    >>> s = "a = 'а́́́́́́́́́́''а́́́́́́́́́́''а́́́́́́́́́́''а́́́́́́́́́́'"
    >>> len(s)
    65
    >>> sum(not unicodedata.combining(c) for c in s)
    16
  4. added a commit that references this issue on May 30, 2019
    ed954b4
  5. changed the title [-]E501 Combining diacritics counted against line length[/-] [+]E501: Combining diacritics counted against line length[/+] on Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions