Skip to content

Commit

Permalink
[too-many-positional-arguments doc] Add the main option to use, real …
Browse files Browse the repository at this point in the history
…example (#9957)
  • Loading branch information
Pierre-Sassoulas committed Sep 24, 2024
1 parent 30ae33f commit 83cc31c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 5 additions & 4 deletions doc/data/messages/t/too-many-positional-arguments/bad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class FiveArgumentMethods:
"""The max positional arguments default is 5."""
# +1: [too-many-positional-arguments]
def calculate_drag_force(velocity, area, density, drag_coefficient):
return 0.5 * drag_coefficient * density * area * velocity**2

def take_five_args(self, a, b, c, d, e): # [too-many-positional-arguments]
pass

drag_force = calculate_drag_force(30, 2.5, 1.225, 0.47)
10 changes: 6 additions & 4 deletions doc/data/messages/t/too-many-positional-arguments/good.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class FiveArgumentMethods:
"""The max positional arguments default is 5."""
def calculate_drag_force(*, velocity, area, density, drag_coefficient):
return 0.5 * drag_coefficient * density * area * velocity**2

def take_five_args(self, a, b, c, d, *, e=False):
pass

drag_force = calculate_drag_force(
velocity=30, area=2.5, density=1.225, drag_coefficient=0.47
)
4 changes: 2 additions & 2 deletions doc/data/messages/t/too-many-positional-arguments/pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MESSAGES CONTROL]
disable=too-many-arguments
[DESIGN]
max-positional-arguments=3

0 comments on commit 83cc31c

Please sign in to comment.