Skip to content

Conversation

antoniogamizdelgado
Copy link
Contributor

This fixes 2 bugs in the computation:

Never is handled in addition to NoReturn.
Give priority to the explicit --never-returning-functions option.

This PR was copied from #9535 (I cannot add commits there and we really need this).

Type of Changes

Type
🐛 Bug fix

Description

Closes #7565

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label May 3, 2024
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.2.0 milestone May 3, 2024
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.

Hey thank you for taking over @antoniogamizbadger ! I feel like we lack some functional tests. (Shouldn't there be a Never used somewhere ?) That could be taken from the example in the original issue directly. Also the tests are not passing in the CI right now. When a message is expected in functional tests it's indicated with # [message-name] styile comment.

@jacobtylerwalls jacobtylerwalls modified the milestones: 3.2.0, 3.3.0 May 7, 2024
@DanielNoord
Copy link
Collaborator

@antoniogamizbadger Would you like to continue working on this?

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@jacobtylerwalls
Copy link
Member

@antoniogamizbadger Thanks for the contribution!

@jacobtylerwalls
Copy link
Member

(Shouldn't there be a Never used somewhere ?)

This is covered by the call to assert_never(), which is annotated to return Never. Reverting that part of the patch causes a test failure, so it's covered.

@jacobtylerwalls jacobtylerwalls enabled auto-merge (squash) July 15, 2024 18:07
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.78%. Comparing base (d9ea2f7) to head (95b6e8b).
Report is 123 commits behind head on main.

Files with missing lines Patch % Lines
pylint/checkers/refactoring/refactoring_checker.py 71.42% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9591      +/-   ##
==========================================
- Coverage   95.80%   95.78%   -0.02%     
==========================================
  Files         174      174              
  Lines       18885    18880       -5     
==========================================
- Hits        18092    18085       -7     
- Misses        793      795       +2     
Files with missing lines Coverage Δ
pylint/checkers/variables.py 97.23% <ø> (ø)
pylint/checkers/refactoring/refactoring_checker.py 98.16% <71.42%> (-0.22%) ⬇️

@jacobtylerwalls jacobtylerwalls disabled auto-merge July 15, 2024 18:08
@jacobtylerwalls jacobtylerwalls changed the title Fix 'function never returning' computation Give preference to --never-returning-functions in inconsistent-return-statements check Jul 15, 2024
@jacobtylerwalls
Copy link
Member

Coverage decrease is from moving existing uncovered lines around.

Copy link
Contributor

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

This comment was generated for commit 95b6e8b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component python 3.11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typing_extensions assert_never's Never not supported
4 participants