Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of meta-issue #1518116: [meta] Make Core pass Coder Review
- Syslog module passes on the Drupal 8 branch test code review tab with one minor error. The items are not itemized on that tab.
- With the latest patch applied, Drupal Code Sniffer reports no errors, and...
- Coder Review finds no problems at the minor (strictest) severity warning level.
Comment | File | Size | Author |
---|---|---|---|
#29 | drupal.make-syslog-module-pass-coder-review.1533392-29.patch | 1014 bytes | amitgoyal |
Comments
Comment #1
FluxSauce CreditAttribution: FluxSauce commentedComment #2
FluxSauce CreditAttribution: FluxSauce commentedCompleted.
Comment #4
TravisCarden CreditAttribution: TravisCarden commentedAnd again #1533202-4: Make config module pass Coder Review. :) Thanks for taking on so many patches, @FluxSauce!
Comment #5
FluxSauce CreditAttribution: FluxSauce commented#2: syslog_standardized-1533392.patch queued for re-testing.
Comment #6
FluxSauce CreditAttribution: FluxSauce commentedThe patch passed upon re-test. Updated summary; thanks for the feedback @TravisCarden!
Comment #7
TravisCarden CreditAttribution: TravisCarden commentedI don't think this is the right change. This dockblock is documenting the DEFAULT_SYSLOG_FACILITY constant, not the file. I don't see that any of the review tools complained about where it was to begin with. What made you change it?
This line needs a period at the end of it.
This should just be
I don't think these need to be translated. What made you change this?
This should just be
Comment #8
FluxSauce CreditAttribution: FluxSauce commentedIt was reported with CodeSniffer.
The content of the comment, specifically referring to LOG_LOCAL* availability and providing context for syslog, apply to the entire module and not just that if/else statement at the top. I felt that it was more appropriate to provide that context at a high-level rather than sticking in an if statement. I can switch it back, but I don't feel that it's right where it is right now.
I had assumed that strings needed to be translatable; as it's not public facing, I guess there's no justification and I've reverted.
I've removed the doc block from
getInfo()
andsetUp()
based on Drupal SimpleTest coding standards, which I wasn't aware of previously.Thanks for the review, I've attached an amended version.
Comment #9
TravisCarden CreditAttribution: TravisCarden commentedOkay, thanks for the explanation.
This comment is specifically explaining what the "if" statement is doing. If anything, I think it should be moved above the "if" statement, but I don't think we want to move it away from the code it's actually documenting. According to the coding standards, it is proper to document constants with docblocks. I take CodeSniffer is complaining because it's inside a control structure ("inline"). Let's get someone else's feedback on this.
Please update the issue summary as appropriate. Thanks!
Comment #9.0
TravisCarden CreditAttribution: TravisCarden commentedSummarizing work completed
Comment #10
TravisCarden CreditAttribution: TravisCarden commentedOops.
Comment #11
FluxSauce CreditAttribution: FluxSauce commentedSummary updated, submitted #1545476: false positive "Missing function doc comment" error on Simple Test inherited methods.
Comment #12
dinakaran.ilango CreditAttribution: dinakaran.ilango commentedat first it is shown me the following errors
i applied the patch in #8 it doesn't show any errors
so i assumed that there is no error
correct me if i was wrong
Comment #13
jhodgdonUmmm... In the patch, what is this supposed to mean?
I don't understand from this what the keys are.
Also, regarding comment #9 above, I agree with Travis. That doc block is documenting the define, and if Coder/Sniffer/whatever is complaining, the complaint is wrong, not the code/comment.
And regarding the review in #12, ... do we have review instructions for these patches? In any case, coder/sniffer/whatever needs to be verified, after the patch has been applied (I don't care about before), to *all* the PHP files in the modules/syslog directory (and subdirectories).
Comment #14
FluxSauce CreditAttribution: FluxSauce commentedI've attached a new version of the patch.
I disagree with the reasoning regarding the commenting at the beginning of
syslog.module
, but I'll leave it for consensus sake.This is how it's currently written:
This is how I feel it should be written; more contextually accurate and doesn't trigger PHP_CodeSniffer.
Comment #15
FluxSauce CreditAttribution: FluxSauce commentedComment #15.0
FluxSauce CreditAttribution: FluxSauce commentedUpdating with false positives.
Comment #16
jhodgdonThe problem with the idea in #14 is that it doesn't put a /** documentation block before the define(), meaning that there is no official documentation for that define, which we would like to have. If code sniffer is complaining, that that is a bug in code sniffer, IMO.
Comment #17
FluxSauce CreditAttribution: FluxSauce commented@jhodgdon I see what you're saying; Documenting constants and variables doesn't cover this exactly; defines should be documented with the /** docblock, but it doesn't (at least that I can see) mention explicitly how to indent in this situation. I don't want to point fingers at code sniffer until I can cite exactly what's wrong :-)
Comment #18
jhodgdonThis is such a rare case (once in all of core, I believe) that I don't think we want to document it on node/1354. But we in general make docblocks match the indentation of the code they are documenting, and definitely all in-code comments in general get indented to the same level as the code they are commenting, so I think this way of doing it makes sense, even if Code Sniffer doesn't.
Comment #19
FluxSauce CreditAttribution: FluxSauce commentedGot it, I'll consider it an edge case. If I run into it again, I'll report it to drupalcs.
My last patch didn't change that section, so it's still good.
Comment #19.0
FluxSauce CreditAttribution: FluxSauce commentedUpdating with progress and consensus.
Comment #20
TravisCarden CreditAttribution: TravisCarden commentedThe latest dev version of drupalcs doesn't complain at all anymore. I've updated the summary.
Comment #21
manarth CreditAttribution: manarth commentedSome of the code referred to here - the
DEFAULT_SYSLOG_FACILITY
definition - isn't actually used.There's an issue to have that code removed: #1618178: Remove redundant DEFAULT_SYSLOG_FACILITY definition from Syslog
Comment #22
TravisCarden CreditAttribution: TravisCarden commentedPostponing till feature freeze. If you want to help in the meantime, please work on the blockers on the meta issue. Thanks!
Comment #23
FluxSauce CreditAttribution: FluxSauce commentedComment #23.0
FluxSauce CreditAttribution: FluxSauce commentedUpdated issue summary.
Comment #24
TravisCarden CreditAttribution: TravisCarden commentedComment #25
visabhishek CreditAttribution: visabhishek commentedComment #26
visabhishek CreditAttribution: visabhishek commentedI have created a patch. Please review.
Comment #27
visabhishek CreditAttribution: visabhishek commentedI have updated this patch as per https://drupal.org/comment/8601579#comment-8601579.
Comment #28
Jalandhar CreditAttribution: Jalandhar commentedPatch #27 needs reroll.
Comment #29
amitgoyal CreditAttribution: amitgoyal commentedReroll of #27.
Comment #30
xjmThanks for all the work here so far. See #1518116-86: [meta] Make Core pass Coder Review. This issue is postponed until the meta issue is either closed or reopened.
Comment #31
xjmComment #32
tatarbjClosing in favor of #2571965: [meta] Fix PHP coding standards in core. In this issue the coding standards will be fixed on a sniff-per-sniff basis rather than a module-per-module basis.