Skip to content
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

Improve documentation for PLR0917 around keyword only parameters #11868

Closed
Renkai opened this issue Jun 14, 2024 · 3 comments · Fixed by #11978
Closed

Improve documentation for PLR0917 around keyword only parameters #11868

Renkai opened this issue Jun 14, 2024 · 3 comments · Fixed by #11978
Labels
documentation Improvements or additions to documentation

Comments

@Renkai
Copy link

Renkai commented Jun 14, 2024

By the document, PLR0917 shall only happen in a function call, not in the function definition.
https://docs.astral.sh/ruff/rules/too-many-positional/

But in the tests, it will fail in the function definition.
From the tests, it's more like too-many-no-default rather than too-many-positional

https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/resources/test/fixtures/pylint/too_many_positional.py

@dhruvmanila
Copy link
Member

Hi, thanks for opening this issue!

By the document, PLR0917 shall only happen in a function call, not in the function definition.
docs.astral.sh/ruff/rules/too-many-positional

Can you clarify this bit? I might be misunderstanding what you're trying to say but from my perspective the docs does mean function definitions:

"Checks for function definitions that include too many positional arguments."

@dhruvmanila dhruvmanila added the question Asking for support or clarification label Jun 14, 2024
@Renkai
Copy link
Author

Renkai commented Jun 15, 2024

Sorry I misunderstood the document earlier, that's because I didn't know to use * to force keyword argument is a feature of Python language. I thought it's a feature of linter shall only be check in the function call not function definition. Maybe we can add this to document of linter to avoid misunderstanding.

https://docs.python.org/3/tutorial/controlflow.html#special-parameters

@zanieb zanieb added the documentation Improvements or additions to documentation label Jun 15, 2024
@dhruvmanila
Copy link
Member

Happy to accept a PR to improve the documentation. Maybe we can provide a reference to https://docs.python.org/3/tutorial/controlflow.html#special-parameters.

@dhruvmanila dhruvmanila removed the question Asking for support or clarification label Jun 18, 2024
@dhruvmanila dhruvmanila changed the title PLR0917 wrong implementation Improve documentation for PLR0917 around keyword only parameters Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants