-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
[Docs] Add XML doc for Squiz.Commenting.BlockComment sniff #848
base: master
Are you sure you want to change the base?
[Docs] Add XML doc for Squiz.Commenting.BlockComment sniff #848
Conversation
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.
Hi @costdev Welcome and thank you for your willingness to contribute to PHP_CodeSniffer!
I love the effort you've put into this one. Having said that, the doc is quite large now, which makes me wonder if it would be possible to convey the same information in a slightly more succinct manner to improve the chances of it actually getting read 😉
Here are some suggestions to consider, but please think it over yourself and feel free to deviate:
- What about including a short description of what is considered a "block comment" in the first
<standard>
block ? - First
<standard>
has five code comparisons - could the same information be conveyed in maybe two code comparisons ?
And maybe one of the remaining "valid" comparisons could use aligned stars at the start of each line for variation ? - What about combining the "Block comment text should start on a new line." and the "The first line should not be empty." standards as they kind of enforce the same thing ?
- I seem to be missing some guidance on the indentation requirements for the star of the docblock closer (
LastLineIndent
error code) ?
I also wonder what guided the order of the <standard>
blocks. To me, it feels a bit all over the place, jumping from start of block comment formatting to end formatting, to within formatting, to before formatting etc...
I can imagine the documentation may be easier to take in if the rules were ordered to follow the structure of the docblock ?
Lastly, the <em>
tags should be used in both the "valid" as well as the "invalid" code samples. They seem to be missing from the "valid" ones now.
Let me know if you have any questions, if not, I look forward to the next iteration.
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
The block comment closer should be on a new line. |
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 haven't checked, but should it just be on a new line or should it be on a line by itself ? (i.e. with nothing after it either)
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.
For example:
<?php
/*
* A block comment
* with multiple lines.
*
* And a second paragraph.
*/doSomething();
This triggers Squiz.Commenting.BlockComment.NoEmptyLineAfter
.
Do you think an example of this should be included in a code comparison here, or should I add a second example (in the same code comparison block) here?
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
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.
Please end the file on a new line.
Co-authored-by: Juliette <[email protected]>
Sure!
That sounds good. I can merge the
While they enforce separate things, for documentation it's probably not necessary to be as verbose as I was in separating these two. I think "Block comment text should start on a new line." probably covers it well, so I can even just remove "The first line should not be empty.".
I wasn't totally sure about covering this one separately, as it felt covered by the "If there are no asterisks" and "If asterisks are used" entries. Would you like me to cover this one separately anyway?
Originally, I was following the order of the errors in the sniff. Afterwards, I felt they were a bit all over the place, so I tried another order which focused on establishing correct openers and closers, then addressed the contents of the comment. Since that too feels a bit all over the place, I'm happy to try a different order. How does this sound?
Woops. I got it into my head that only the "invalid" needed to be highlighted. No idea how that happened since it's explicitly stated in the contributing guidelines. 😅 |
Follow-up on the explanation of a block comment: I want to make sure I capture the right concept in the explanation.
If you agree with the above, what do you think of this for the first
|
Description
Adds XML doc for the
Squiz\Commenting\BlockComment
sniff.Suggested changelog entry
Add XML doc for Squiz.Commenting.BlockComment sniff
Related issues/external references
Partial fix for #148
Types of changes
PR checklist