Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use-maxsplit-arg false positive with custom split method #4857

Closed
khameeteman opened this issue Aug 17, 2021 · 2 comments · Fixed by #8114
Closed

use-maxsplit-arg false positive with custom split method #4857

khameeteman opened this issue Aug 17, 2021 · 2 comments · Fixed by #8114
Assignees
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@khameeteman
Copy link

khameeteman commented Aug 17, 2021

Bug description

I get a false positive when implementing a split method on a custom class:

class Obj:

    def split(self, point):
        return 0, 1


obj = Obj()
obj.split((0, 0))[0]

Problem seems to be in the [0] part. When I change this to [1], no warning is shown.

Configuration

No response

Command used

pylint --rcfile=.pylintrc module

Pylint output

C0207: Use obj.split((0, 0), maxsplit=1)[0] instead (use-maxsplit-arg)

Expected behavior

No warning

Pylint version

pylint 2.9.6
astroid 2.6.6
Python 3.6.14 (default, Aug  9 2021, 06:21:09)

OS / Environment

No response

Additional dependencies

No response

@khameeteman khameeteman added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 17, 2021
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 17, 2021
@cdce8p
Copy link
Member

cdce8p commented Aug 18, 2021

/CC: @yushao2

@Pierre-Sassoulas Pierre-Sassoulas added Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Bug 🪲 labels Jul 2, 2022
@yushao2
Copy link
Contributor

yushao2 commented Jan 26, 2023

/CC: @yushao2

take

@yushao2 yushao2 self-assigned this Jan 26, 2023
Pierre-Sassoulas added a commit that referenced this issue Jan 30, 2023
Closes #4857 

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants