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

Implemented new checker invalid-class-object #4510

Merged
merged 4 commits into from
May 26, 2021

Conversation

yushao2
Copy link
Collaborator

@yushao2 yushao2 commented May 25, 2021

Steps

  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

Implemented a new checker invalid-class-object, which checks for cases where a non-class object is assigned to the __class__ attribute

Also, refactored files in functional test suite

Type of Changes

Type
✨ New feature

Related Issue

Closes #585

@yushao2
Copy link
Collaborator Author

yushao2 commented May 25, 2021

P.S.: I'm not too familiar with working with __class__ myself, so the functional test suite might be incomplete

@yushao2 yushao2 marked this pull request as draft May 25, 2021 15:56
@yushao2 yushao2 marked this pull request as ready for review May 25, 2021 16:14
@coveralls
Copy link

coveralls commented May 25, 2021

Coverage Status

Coverage increased (+0.005%) to 91.841% when pulling e111796 on yushao2:checkers-585 into 12af1ce on PyCQA:master.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Nice, that's an old issue you're fixing here !

pylint/checkers/classes.py Show resolved Hide resolved
@Pierre-Sassoulas Pierre-Sassoulas added Checkers Related to a checker Enhancement ✨ Improvement to a component labels May 25, 2021
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

Why did you move the tests cases? Not sure this is really necessary. If it is, it would probably be better to do it in a separate PR.

@yushao2
Copy link
Collaborator Author

yushao2 commented May 26, 2021

Why did you move the tests cases? Not sure this is really necessary. If it is, it would probably be better to do it in a separate PR.

An error was being thrown that the invalid subfolder had too many test cases.

Maybe i can undo moving all test cases, and keep this in a subfolder. What do you think?

@Pierre-Sassoulas
Copy link
Member

I think we can keep the file moved the way you did, it's not confusing. Maybe in another MR that we'll rebase this one on ?

@yushao2
Copy link
Collaborator Author

yushao2 commented May 26, 2021

I think we can keep the file moved the way you did, it's not confusing. Maybe in another MR that we'll rebase this one on ?

sorry, so I should leave the files as how i moved them in this MR? just to clarify

@Pierre-Sassoulas
Copy link
Member

Yes, looks fine to me, there is a lot of functional tests starting by "invalid" so separating them again like you did make sense.

@yushao2
Copy link
Collaborator Author

yushao2 commented May 26, 2021

Yes, looks fine to me, there is a lot of functional tests starting by "invalid" so separating them again like you did make sense.

for now, in this MR, i separated only those with > 2 files so that it would not be too heavy on the refactoring

Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

Ok, let's merge it then!

@cdce8p cdce8p merged commit 4023a4f into pylint-dev:master May 26, 2021
@yushao2 yushao2 deleted the checkers-585 branch May 26, 2021 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[easy] __class__ must be set to a class
4 participants