In the ArgumentValidatorPluginBase class (in the Views module), the validateArgument() method has no documentation at all.

Furthermore, the rest of the methods need a little documentation help -- most of them have non-conforming first lines. Every function/method should have a first line summary that starts with a third person verb (like "Determines" not "Determine"). This first line should be followed by a blank line, then the rest of the method documentation (if any).

Comments

joachim created an issue. See original summary.

jhodgdon’s picture

Title: missing docs for ArgumentValidatorPluginBase::validateArgument() » No docs for ArgumentValidatorPluginBase::validateArgument(); other methods have bad first lines
Issue summary: View changes
Issue tags: +Novice

This page has some information about what argument validator plugins do, so it might be helpful for writing docs:

https://api.drupal.org/api/drupal/core!modules!views!src!Plugin!views!ar...

Given that... probably a good Novice project? I presume that the validateArgument() method is the main one that actually does the validation.

Actually, as long as we are fixing this issue, maybe we could fix up the other method documentation on this class. Every function/method should have a first line summary that starts with a third person verb (like "Determines" not "Determine"). Fixing this would not add much to the patch. Adding to issue summary and title.

joelrguezaleman’s picture

Created patch for this issue.

I´ve added docs for the validateArgument method. Also, since I saw that some comments ended with a dot and some others didn´t, I´ve added a dot to the ones that didn´t. As for the bad first lines, after cloning the repo and checking out 8.2.x branch, I see that these are alright.

joelrguezaleman’s picture

Issue summary: View changes
Status: Active » Needs review
dimaro’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
@@ -62,17 +62,17 @@ protected function defineOptions() { return array(); }
-   * Provide the default form form for validating options
+   * Provide the default form form for validating options.
...
-   * Provide the default form form for submitting options
+   * Provide the default form form for submitting options.

Duplicated word? (form)

joelrguezaleman’s picture

Issue tags: +DrupalCampES
StatusFileSize
new1009 bytes

Fixed.

dimaro’s picture

Status: Needs work » Needs review

Change status for run tests.

Status: Needs review » Needs work
dimaro’s picture

Status: Needs work » Needs review
StatusFileSize
new1009 bytes
new1.71 KB

The latest patch does not include all changes corrected on #3.
Upload a new patch with an interdiff.

zerolab’s picture

Status: Needs review » Needs work

As @jhodgdon mentioned in #2, "Every function/method should have a first line summary that starts with a third person verb (like "Determines" not "Determine")."

joelrguezaleman’s picture

Status: Needs work » Needs review
StatusFileSize
new2.39 KB
new2.38 KB

Fix #10. Adding interdiff and full patch.

jhodgdon’s picture

Status: Needs review » Needs work

Thanks! This is mostly great. Just a few places need attention:

  1. +++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
    @@ -51,33 +51,33 @@ public function setArgument(ArgumentPluginBase $argument) {
       /**
    -   * Retrieve the options when this is a new access
    -   * control plugin
    +   * Retrieves the options when this is a new access
    +   * control plugin.
    

    The first line of a doc block needs to be a one-line description, ending in . This is two lines. I think all of it will fit in one line (<= 80 characters).

  2. +++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
    @@ -51,33 +51,33 @@ public function setArgument(ArgumentPluginBase $argument) {
       /**
    -   * If we don't have access to the form but are showing it anyway, ensure that
    +   * If we don't have access to the form but are showing it anyway, ensures that
        * the form is safe and cannot be changed from user input.
    

    This needs to be split into two paragraphs.

    The first one should start with "Ensures", and should be a 1-line description of the function.

    If there is more information that needs to be said and cannot fit in one line, put in a blank line and then put the additional information into a new paragraph (perhaps into the next paragraph that is already below here?).

joelrguezaleman’s picture

Status: Needs work » Needs review
StatusFileSize
new1.18 KB
new2.4 KB

Fix #12.

jhodgdon’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/src/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php
@@ -91,10 +89,15 @@ protected function checkAccess(&$form, $option_name) {
+   *
+   * This method needs to be overriden by child classes.
+   */

Sorry, I should have said this in the last review.

Most of the methods on this class are expected to be overridden by child classes (if appropriate). I really don't think we need this line on this one in particular. We don't normally do that in base classes.

The rest looks good, thanks!

nesta_’s picture

Status: Needs work » Needs review
StatusFileSize
new667 bytes
new2.34 KB

Try to fix commented above on #14

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks OK to me. Definitely an improvement over what was there (or not there) before.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 8ef1d38 and pushed to 8.1.x and 8.2.x. Thanks!

I'm guessing but there is probably alot more views docs to fix out there. With respect to issue scope - when changing or adding documentation doing it per class per type of documentation makes sense.

  • alexpott committed 5e9b8c8 on 8.2.x
    Issue #2710395 by joelrguezaleman, dimaro, nesta_, jhodgdon: No docs for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.