wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

WPS226: Ignore use of ellipsis constant ('...')

Open hgylfason opened this issue 2 years ago • 2 comments

Rule request

Thesis

It's very common to use ellipsis (...) to indicate a string output has been shortened. I'm using the textwrap utility module from Python and you quickly break the rule WPS226 that prevents literal overuse.

Here is a contrived example:

import textwrap

def __str__(self):
    return textwrap.shorten(
        text='{0}'.format(
            self.question.text,
        ),
        width=40,
        placeholder='...',
    )

Reasoning

I think ellipsis '...' is a known concept and as a literal would not degrade the readability of the code.

hgylfason avatar Nov 17 '22 15:11 hgylfason

Ok, seems reasonable. Please, send a PR

sobolevn avatar Nov 18 '22 10:11 sobolevn

Will do 👍

On 18 Nov 2022, at 10:43, Nikita Sobolev wrote:

Ok, seems reasonable. Please, send a PR

-- Reply to this email directly or view it on GitHub: https://github.com/wemake-services/wemake-python-styleguide/issues/2545#issuecomment-1319829179 You are receiving this because you authored the thread.

Message ID: @.***>

hgylfason avatar Nov 18 '22 15:11 hgylfason