-
Notifications
You must be signed in to change notification settings - Fork 15
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
Adjust default option based on the --style
#14
Comments
I'm very hesitant to change the defaults, because if I flip some defaults for your use case today, there will be other users who open issues and ask me to flip them back. What I recommend instead is to use a config file (see this section in the documentation) and define the options that you need. As you can see, being author of pydoclint, even I need to configure something when pydoclint is linting itself: Lines 9 to 12 in c0e69fd
|
I think this is already the case today (v0.0.6). I just tested on this code example, and pydoclint doesn't complain: def myfunc(arg1, arg2, arg3):
"""
Do something
Args:
arg1: Arg 1
arg2: Arg 2
arg3: Arg 3
"""
print(123) |
I don't agree with this, I think if I use google-style it is very confusing that correctly formatted google-style comments produce errors. Clearly people using non-standard google-style should pass special customization options themselves. Also this is a very common pattern in other linting tools that can adjust to one or other style, what that usually means is just setting a group of options automatically for you. Of course I can go and configure the options I need and forget about it, but project-wise I think it is a mistake not to adjust the defaults because it will just make the life of new users more complicated for no reason. I do see how changing defaults can have nasty effects on existing users, as it is effectively a breaking change, but since this project is so young, I think that should not be a problem. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi @leandro-lucarella-frequenz , I did quite a bit of research on the topic of whether to allow
Given the 4 points above, I think what I plan to do is the following:
|
Currently, pydoclint already can do this: "if both have a type hint, that they match". However, pydoclint does not do My philosophy is: pydoclint should not perform duplicated checks. In this case, the presence of type hints can be (and should better be) checked by mypy. Similarly, pydoclint doesn't check the presence of a docstring (because this should be handled by pydocstyle). (Disclaimer: I'm well aware that pydoclint hasn't introduced mypy yet 😂. I opted for moving fast in the early stage, and I do plan to add mypy checks in pydoclint soon.) |
And let me address this issue that you raised:
This is an expected behavior and here is why: If you set style to "numpy", the docstring parser doesn't recognize what This essentially makes the whole docstring a "short docstring" (i.e., a docstring with only text descriptions). By default, pydoclint doesn't check short docstrings (the So if you flip this option: pydoclint --style=numpy -scsd=False script.py you'll see violations:
Do you think I should flip the default of |
Just for the records, I'm not saying to make it a global default, I'm saying once you parse the
I really don't see how it is vague. I'm not saying it *should be, but it may be, it is allowed. That's pretty clear to me because the example exactly in the section you linked have the
To be honest I think then Sphinx is not really following Google style, but I can see your concern there. That said.....
This is a good point.
And this seems like a very reasonable compromise. 👍 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Yeah, can you create a new issue to discuss the |
I'm undecided about the default, I don't think it is well specified in the style guide, but I'm very happy that you can turn this on in That said, I still believe that not allowing to skip specifying types in the |
Let me clarify my point on My philosophy is: if a user wants to ensure type hints in function signatures, use If, on the other hand, a user doesn't want to ensure type hints in function signatures, I think at some point, I'll need to add a paragraph or two in the readme to explain these details. |
I think I'll flip the default of This way, the philosophy of pydoclint is more consistent: the default options are the most strict, and users can read the documentation to relax some options. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Let's continue our discussion in #19 then. |
Hi @leandro-lucarella-frequenz , with #19 closed, have we addressed all the topics in this issue? If so, I think we can close this one? |
Closing this issue. No actions needed at this point. (If I closed this issue by accident, please feel free to leave a comment here.) |
Now that google-style is also supported, it would be good if other options are adjusted to what is valid for google-style. For example:
--allow-init-docstring
should default toTrue
--check-type-hint
should default toFalse
(ideally it should be checked if the function has type hints in the signature, then type hints can be omitted in the docstring, otherwise it should be present)The text was updated successfully, but these errors were encountered: