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

Add new checker useless-return #1823

Merged
merged 1 commit into from Jan 25, 2018

Conversation

Projects
None yet
2 participants
@atodorov
Contributor

atodorov commented Jan 5, 2018

Another take on #1821 only producing messages if there is ony 1 return statement at the end of the function.

@PCManticore

This looks good. It will also need a ChangeLog entry as well as a What's new entry.

@@ -174,6 +174,11 @@ class RefactoringChecker(checkers.BaseTokenChecker):
'state this as return None, and an explicit return statement '
'should be present at the end of the function (if reachable)'
),
'R1711': ("Useless return at end of function or method",
'useless-return',
'Emitted when a single "return" or "return None" statement is found '

This comment has been minimized.

@PCManticore

PCManticore Jan 23, 2018

Member

Can you add another sentence saying why this can be removed? e.g because the function has an implicit return of None etc.

@PCManticore

PCManticore Jan 23, 2018

Member

Can you add another sentence saying why this can be removed? e.g because the function has an implicit return of None etc.

Show outdated Hide outdated pylint/test/unittest_checker_refactoring.py Outdated
@atodorov

This comment has been minimized.

Show comment
Hide comment
@atodorov

atodorov Jan 23, 2018

Contributor

All fixed, let me know if you have more comments.

Contributor

atodorov commented Jan 23, 2018

All fixed, let me know if you have more comments.

Add new checker useless-return
warns about a single "return" or "return None" statement at the
end of functions or methods
@PCManticore

This comment has been minimized.

Show comment
Hide comment
@PCManticore

PCManticore Jan 25, 2018

Member

Thank you @atodorov !

Member

PCManticore commented Jan 25, 2018

Thank you @atodorov !

@PCManticore PCManticore merged commit 95269d7 into PyCQA:master Jan 25, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment