Skip to content

Fix nested-min-max output msg#8234

Merged
Pierre-Sassoulas merged 2 commits into
pylint-dev:mainfrom
clavedeluna:8168-min-max
Feb 8, 2023
Merged

Fix nested-min-max output msg#8234
Pierre-Sassoulas merged 2 commits into
pylint-dev:mainfrom
clavedeluna:8168-min-max

Conversation

@clavedeluna

Copy link
Copy Markdown
Contributor

Type of Changes

Type
🐛 Bug fix

Description

Fix nested-min-max suggestion message to indicate it's possible to splat iterable objects.

Closes #8168

@codecov

codecov Bot commented Feb 8, 2023

Copy link
Copy Markdown

Codecov Report

Merging #8234 (a30dd4b) into main (6a019eb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8234   +/-   ##
=======================================
  Coverage   95.45%   95.45%           
=======================================
  Files         177      177           
  Lines       18646    18654    +8     
=======================================
+ Hits        17798    17806    +8     
  Misses        848      848           
Impacted Files Coverage Δ
pylint/checkers/nested_min_max.py 100.00% <100.00%> (ø)

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks amazing already !

Comment thread tests/test_self.py Outdated
[module, "-E"], expected_output="", unexpected_output=unexpected
)

def test_nested_min_max_splats(self) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can remove this if we also have functional tests(I like functional tests a lot)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You'd think, but functional tests aren't testing the output message language exactly, so I felt better adding this to ensure "*" is in the message

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I understand correctly there is an issue with * in functional tests ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No no, no issue. You can see the functional test .txt file looks great.

What I mean is that as far as I understand, the functional test will ensure that the message
nested-min-max appears in a specific line, indicated by adding # [nested-min-max] to that line

but what I want to test is not just that the msg is emitted, but that the msg suggestion specifically says "it's possible to do 'max(3, *nums, *lst2)' i". I can only assert this in the unit test, not the functional test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

https://github.com/PyCQA/pylint/pull/8234/files#r1100266806 (Modify the expected output in this file and the tests should fail provided you have python 3.8 ore more recent)

Comment thread pylint/checkers/utils.py Outdated
{"_sitebuiltins.Quitter", "sys.exit", "posix._exit", "nt._exit"}
)

DICT_TYPES = (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's keep this in the variable checkers, we don't want to have checkers be coupled because of this constant and the module name 'utils' is horrible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fair point! the repo uses "utils" a ton. So just have both "DICT_TYPES" in each module regardless of duplication?

@github-actions

This comment has been minimized.

Comment thread tests/functional/n/nested_min_max.txt
@github-actions

github-actions Bot commented Feb 8, 2023

Copy link
Copy Markdown
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit a30dd4b

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.17.0 milestone Feb 8, 2023
@Pierre-Sassoulas Pierre-Sassoulas added Enhancement ✨ Improvement to a component Bug 🪲 backport maintenance/2.16.x and removed Enhancement ✨ Improvement to a component labels Feb 8, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.17.0, 2.16.2 Feb 8, 2023
@Pierre-Sassoulas Pierre-Sassoulas merged commit 29684fe into pylint-dev:main Feb 8, 2023
github-actions Bot pushed a commit that referenced this pull request Feb 8, 2023
Pierre-Sassoulas pushed a commit that referenced this pull request Feb 8, 2023
(cherry picked from commit 29684fe)

Co-authored-by: Dani Alcala <112832187+clavedeluna@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive nested-min-max

2 participants