forked from pylint-dev/pylint-django
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore unused-argument warning for request arguments (Fixes pylint-de…
…v#249) The previous implementation (result of pylint-dev#155) of disabling the unused-argument warning for functions/methods having an argument named `request` was to broad. As soon as a function/method contains a `request` argument no unused-argument warning will be issued for this function anymore, even though some other arguments are unused! This commit extends the `ignored-argument-names` regex of Pylint to also ignore arguments named `request`. This way unused-argument warnings will still be issued for every other unused argument of the function/method.
- Loading branch information
Showing
6 changed files
with
36 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
Checks that Pylint still complains about unused-arguments if a function/method | ||
contains an argument named `request`. | ||
""" | ||
# pylint: disable=missing-docstring | ||
|
||
from django.http import JsonResponse | ||
from django.views import View | ||
|
||
|
||
def user_detail(request, user_id): # [unused-argument] | ||
# nothing is done with user_id | ||
return JsonResponse({'username': 'steve'}) | ||
|
||
|
||
class UserView(View): | ||
def get(self, request, user_id): #[unused-argument] | ||
# nothing is done with user_id | ||
return JsonResponse({'username': 'steve'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
unused-argument:11:user_detail:Unused argument 'user_id':HIGH | ||
unused-argument:17:UserView.get:Unused argument 'user_id':INFERENCE |