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

Fix regression in the creation of the __init__ of dataclasses #1812

Merged
merged 5 commits into from Oct 4, 2022

Conversation

DanielNoord
Copy link
Collaborator

Steps

  • For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • Write a good description on what the PR does.

Description

Closes pylint-dev/pylint#7434

Type of Changes

Type
🐛 Bug fix

@DanielNoord DanielNoord added this to the 2.12.11 milestone Sep 30, 2022
@coveralls
Copy link

coveralls commented Sep 30, 2022

Pull Request Test Coverage Report for Build 3176405357

  • 57 of 74 (77.03%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 92.295%

Changes Missing Coverage Covered Lines Changed/Added Lines %
astroid/brain/brain_dataclasses.py 27 29 93.1%
astroid/nodes/node_classes.py 30 45 66.67%
Files with Coverage Reduction New Missed Lines %
astroid/nodes/node_classes.py 1 94.78%
Totals Coverage Status
Change from base Build 3151597495: -0.1%
Covered Lines: 9859
Relevant Lines: 10682

💛 - Coveralls

@DanielNoord
Copy link
Collaborator Author

I expected the coverage to be sup-optimal. I think it's okay to merge this right now. If we start using this method more then the coverage (and potential bugs) will come naturally. You just don't have *args and **kwargs in dataclasses.

@Pierre-Sassoulas
Copy link
Member

I'm way over my head with this MR, I'm going to pass unless there's really no other reviewer.

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an initial skim.

ChangeLog Outdated Show resolved Hide resolved
tests/unittest_brain_dataclasses.py Outdated Show resolved Hide resolved
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@jacobtylerwalls jacobtylerwalls changed the title Fix regression in the creation of the __init__ of dataclassess Fix regression in the creation of the __init__ of dataclasses Oct 1, 2022
Comment on lines -285 to +300
params_string += "*, " + prev_kw_only + ", "
params_string += "*, " + prev_kw_only
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this change? If it's harmless, then consider not making the change to reduce the diff. The elif/else branches below also have the same trailing separator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prev_kw_only now takes care of this itself in the new helper function so there is not need to add it here anymore.

Edit: Let me know if you want me to change this. Otherwise I think this can be merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that explains it. Merge ho!

tests/unittest_brain_dataclasses.py Outdated Show resolved Hide resolved
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@DanielNoord DanielNoord merged commit 1ffe400 into pylint-dev:main Oct 4, 2022
@DanielNoord DanielNoord deleted the dataclasses-KW-ONLY branch October 4, 2022 09:58
@cdce8p cdce8p modified the milestones: 2.12.11, 2.12.12 Oct 16, 2022
Pierre-Sassoulas pushed a commit that referenced this pull request Oct 19, 2022
)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Pierre-Sassoulas pushed a commit that referenced this pull request Oct 19, 2022
)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive unexpected-keyword-arg regression for dataclasses
5 participants