Repository navigation
Conversation
jrfnl
left a comment
There was a problem hiding this comment.
@rodrigoprimo Thanks for this PR. The basic formatting and the code comparison all looks good.
Despite the sniff using multiple error messages, I used a single
<code_comparison>block as the valid code examples are essentially the same (per the conversation here #159 (comment)).
Agreed on the last two messages, but the sniff also checks the spacing between the yield and from keywords for a yield from and that is not addressed in the docs now.
I opted to add the list of language constructs that this sniff supports to the description as I was worried some users might get the impression that this sniff works for all language constructs, which is not the case.
Keeping the list in the docs in sync with the token list in the sniff feels very error prone to me. It might be better to update the description to make the same distinction as the sniff does: only language constructs which can be used without parentheses.
I'm fine with mentioning a few examples in the description, though I'm not sure if that's really needed what with the code samples basically already showing examples anyway.
On a side note (I'm happy to move this to its own issue if that is preferable), I wonder if this sniff should remove spaces after language constructs without content? So, for example, should this sniff be triggered when it finds
return ;and fix it toreturn;?
Good observation and the answer is: no, it should not. There are other sniffs to deal with the spacing before a semicolon and the chance of introducing fixer conflicts by adding such a check to this sniff too is not worth it.
This commit improves the description of the LanguageConstructSpacing sniff in the documentation by describing which types of language constructs are affected by this sniff instead of listing all affected language constructs.
This commit improves the documentation by adding another<standard> and <code_comparison> blocks to document how the sniff behaves when handling the `yield from` expression.
|
Thanks for the detailed review, @jrfnl!
I pushed a new commit that adds a
I went with a list of the supported language constructs because I was missing a way to describe them. I agree that your suggestion is much better, and I updated the description.
👍 This PR is ready for another review. |
jrfnl
left a comment
There was a problem hiding this comment.
Thanks for updating this PR @rodrigoprimo! Nearly there, just a grammatical fix needed and then it can be merged.
Co-authored-by: Juliette <[email protected]>
|
I just added a new commit with the change that you suggested. Thanks! |
* Generic/LanguageConstructSpacing: add XML documentation
Description
This PR adds documentation for the Generic.WhiteSpace.LanguageConstructSpacing sniff.
Despite the sniff using multiple error messages, I used a single
<code_comparison>block as the valid code examples are essentially the same (per the conversation here #159 (comment)).I opted to add the list of language constructs that this sniff supports to the description as I was worried some users might get the impression that this sniff works for all language constructs, which is not the case.
On a side note (I'm happy to move this to its own issue if that is preferable), I wonder if this sniff should remove spaces after language constructs without content? So, for example, should this sniff be triggered when it finds
return ;and fix it toreturn;?Suggested changelog entry
Add XML documentation for the Generic.WhiteSpace.LanguageConstructSpacing sniff
Related issues/external references
Part of #148
Types of changes
PR checklist