Wemake-python-styleguide: Add Exceptions for String Constant Overuse

Created on 2 Aug 2020  路  5Comments  路  Source: wemake-services/wemake-python-styleguide

Rule request

I feel it would be good to be able to declare exceptions for WPS226

Thesis / Reasoning

In a file on a current project, I tend to use " ".join(iterable) a lot.
It feels unnatural to declare a CONSTANT for that.
Also, I don't think it is good in this case to disable WPS226 for the entire file as there could be other common string constants.

Alternative: Excluse " ", "", "\n" & friends from this by default.

Hacktoberfest feature good first issue help wanted rule request

All 5 comments

I'm for the last proposed solution 馃憤 No harm in using these strings in-place. They can be excluded onthe wps level by default.

+1. Had a similar case with dict.get(field, '') used for several fields.

Looks like exclusions to the magic numbers (WPS432), which are reasonable, too.

Hi, I would like to help.

Hi, @sumeshpradhan! Thanks a lot!

Can I take this over?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sobolevn picture sobolevn  路  4Comments

sobolevn picture sobolevn  路  5Comments

sobolevn picture sobolevn  路  3Comments

orsinium picture orsinium  路  3Comments

sobolevn picture sobolevn  路  4Comments