-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
Enhancement ✨Improvement to a componentImprovement to a componentGood first issueFriendly and approachable by new contributorsFriendly and approachable by new contributorsHelp wanted 🙏Outside help would be appreciated, good for new contributorsOutside help would be appreciated, good for new contributorsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Current problem
In 2.16.0, consider-using-join was extended to include non-empty separators. This makes pylint complains about the following code:
def test(values: List[str]):
data = ""
for value in values:
data += f"prefix{value}suffix"
return data
However I don't think the suggested refactor is an improvement: prefix and suffix are duplicated and the empty list case need to be handled specifically
def test(values: List[str]):
if not values:
return ""
return "prefix" + "suffixprefix".join(values) + "suffix"
The current options are:
- disable the rule completely. This has the drawback of loosing the previous rule for empty separators.
- use a "pylint: disable" comment. However having to use this on regular basis creates bad habits and reduce the value of linting
Desired solution
Would it be possible to have an option to disable the rule only for the non-empty separator case?
Additional context
No response
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentGood first issueFriendly and approachable by new contributorsFriendly and approachable by new contributorsHelp wanted 🙏Outside help would be appreciated, good for new contributorsOutside help would be appreciated, good for new contributorsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation