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

remove no-op if #2619

Merged
merged 1 commit into from
Oct 28, 2024
Merged

remove no-op if #2619

merged 1 commit into from
Oct 28, 2024

Conversation

temyurchenko
Copy link
Contributor

Note the if condition above, the values are asserted to be empty,
so adding them to the result doesn't do anything.

Also remove small inefficiencies

Type of Changes

Type
🔨 Refactoring

Description

I just noticed a few changes left over after my work on previous PRs and they seemed reasonable enough.

Note the `if` condition above, the `values` are asserted to be empty,
  so adding them to the result doesn't do anything.

Also remove small inefficiencies
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.24%. Comparing base (4a5f5ef) to head (464e327).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2619   +/-   ##
=======================================
  Coverage   93.24%   93.24%           
=======================================
  Files          93       93           
  Lines       11051    11051           
=======================================
  Hits        10304    10304           
  Misses        747      747           
Flag Coverage Δ
linux 93.13% <100.00%> (ø)
pypy 93.24% <100.00%> (ø)
windows 93.24% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/nodes/scoped_nodes/scoped_nodes.py 93.68% <100.00%> (ø)

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

I don't really understand the change with __bases__ , could you explain?

The rest makes sense. Not doing the copy() but having result is much better

@temyurchenko
Copy link
Contributor Author

I don't really understand the change with __bases__ , could you explain?

Sure. Here's the code in question:

    if bla-bla and **not values**:
        ...
        if name == "__bases__":
            result += **values**

Note that inside the body of the first if, values is empty. Thus, adding it to anything is a no-op. Thus, we can just remove that statement.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for that explanation, probably needed some more coffee when I reviewed this 😄

@DanielNoord DanielNoord merged commit e380fd1 into pylint-dev:main Oct 28, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants