-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Set up system of code examples and details for message documentation #5934
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| def foo(): | ||
| pass # [emtpy-docstring] | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,2 @@ | ||||||||||||
| def foo(): | ||||||||||||
| """A dummy description.""" | ||||||||||||
|
Comment on lines
+1
to
+2
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, what does adding |
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,2 @@ | ||||||||||
| async def foo(): | ||||||||||
| yield from [1, 2, 3] # [yield-inside-async-function] | ||||||||||
|
Comment on lines
+1
to
+2
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The message can't be emitted when using Python < 3.5. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||||||||||||||||||||||||||
| async def foo(): | ||||||||||||||||||||||||||||||
| def _inner_foo(): | ||||||||||||||||||||||||||||||
| yield from [1, 2, 3] | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| async def foo(): | ||||||||||||||||||||||||||||||
| yield 42 | ||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - `PEP 525 <https://peps.python.org/pep-0525/>`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to the actual MR, but I think code example could be 'real' and 'exciting' with animal, vegetal and real concepts or code example to be more rememberable. Also typing by default would influence begginner to use it later.
Foos and bars are traditional and have the benefit of not introducing more concept than the message itself, but also a little boring and I think human learn better with (fun) examples than with generic examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, in this case it doesn't really hurt, but I actually think the examples should be as bare bones as possible. That helps to identify the actual issue.
To make a (bad) example from this case: is
empty-docstringraise for all functions or only for functions with parameters? In this case it doesn't really matter because that though is nonsensical, but I think there are messages where it actually helps if the example is as simple as possible.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right about "any", maybe we could another example ? (
def do_nothing() -> None:).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're also right about barebone being a good thing, but I dislike foo/bar for documentation. For a beginner the first thing they have to do is to read https://en.wikipedia.org/wiki/Foobar and learn about our little software programmer internal meme. We can probably make barebone examples that school children would understand without prior knowledge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah shit, I completely forgot about this.
I'll keep it in mind for future PRs 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry we'll have to review hundred of examples that were in pylint-error, there's no use nitpicking about the style right now 😄