Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Lars Toomre’s picture

#1802070: Add missing type hinting to Action module docblocks is open to deal separately with any missing type hinting from @param and/or @return directives.

amitgoyal’s picture

Assigned: Unassigned » amitgoyal
Status: Active » Needs review
FileSize
10.51 KB
3.4 KB

Based on the learnings from #1533244: Make help module pass Coder Review issue, I have made fixes, related to coding standards, in Action module. As per learning there, I have ignored following issues,

- Missing parameter type at position x
- Data type of return value is missing
- If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
- No scope modifier specified for function getInfo() in class files

Attaching a Patch here which will fix the remaining issues. I am also attaching Coder output coder_issues_action_2012_10_22.txt so that we can see the list of all issues.

I am not sure about this particular issue "Data type of return value is missing". Please let me know if I need to fix it.

Kars-T’s picture

Status: Needs review » Needs work

The patch fixes the issues stated in #3.

But the coding standard changed for Drupal 8.

http://drupal.org/node/1354#functions

Data types on param/return

Note: This section of the standard was adopted as of Drupal 8. In previous versions, data type specification was recommended in the case of non-obvious types or specific classes/interfaces only.

The data type of a parameter or return value MUST be specified in @param or @return directives, if it is not obvious or of a specific class or interface type.

The data type MAY be specified (as in: recommended) for other @param or @return directives, including those with primitive data types, arrays, and generic objects (stdClass).

I am setting this to "needs work" as it seems we now should check if the data type for return is obvious. But I have no clue what "obvious" really means here. Is it obvios if its a very short function? How obvious is an array?

amitgoyal’s picture

Status: Needs work » Needs review

@Kars-T - Please see #5 here #1518116: [meta] Make Core pass Coder Review. It's clearly mentioned that "The one exception to the rule is for adding param/return datatypes which will be handled in #1800046: [META] Add missing type hinting to core docblocks, fix Drupal.Commenting.FunctionComment.Missing*".

So changing the status back to 'needs review'.

Kars-T’s picture

Ah okay. Than I'd say it is RTBC but as my english is to weak to evaluate the comments I leave the status as it is :)

Lars Toomre’s picture

Thanks for the patch @amitgoyal. I hope to do a detailed review of this later today.

If you have not seen the comment yet, please take a look at what I added in #1816690-7: Make Ban module pass Coder Review. I would love to see similar reports to what is in #3 for the Node, System and/or Taxonomy modules.

The other thing that would be helpful is to generate a separate patch for #1802070: Add missing type hinting to Action module docblocks that addresses all of the type hinting for @param and @return directives that are highlighted in the report in #3, but not included in the patch for this issue.

As you might be aware, performing a detailed review of type hinting patches for @param and @return directives takes quite a bit of time. Hence, they are being broken out separately, and in the case of modules needing many additions, being added in several incremental patches.

This past weekend I spent considerable time performing such reviews of patches for the Overlay, PHP, Poll, Syslog, Tracker, and Update modules. (Each of those patches were generated without the benefit of an excellent automated report like that in #3).

I would be happy to review any such similar patch(es) that might be generated for the Action module.

TravisCarden’s picture

Status: Needs review » Postponed

Postponing till feature freeze. If you want to help in the meantime, please work on the blockers on the meta issue. Thanks!

sphism’s picture

Status: Postponed » Active

We have the go ahead with all these issues again, see #1518116: [meta] Make Core pass Coder Review for more details

pguillard’s picture

Assigned: amitgoyal » pguillard
Issue summary: View changes

I work on it

pguillard’s picture

pfrenssen’s picture

Great start, thanks!

  1. +++ b/core/modules/action/tests/src/Unit/Menu/ActionLocalTasksTest.php
    @@ -16,6 +16,9 @@
    +  /**
    +   * Overrides Tests\Core\Menu\LocalTaskIntegrationTest::setUp().
    +   */
    

    This should be "{@inheritdoc}". We are using this in favour of "Overrides xyz". See Comment standards - inheritdoc.

When scanning all files in the action module I still found 3 additional coding standards violations:

$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,js,css,info,txt ./core/modules/action

FILE: /home/pieter/v/drupal/drupal/core/modules/action/action.module
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 41 | ERROR | Inline doc block comments are not allowed; use "// Comment"
    |       | instead
--------------------------------------------------------------------------------


FILE: ...r/v/drupal/drupal/core/modules/action/src/Plugin/Action/EmailAction.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 161 | WARNING | Line exceeds 80 characters; contains 87 characters
--------------------------------------------------------------------------------


FILE: ...er/v/drupal/drupal/core/modules/action/src/Plugin/Action/GotoAction.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 53 | WARNING | Line exceeds 80 characters; contains 83 characters
--------------------------------------------------------------------------------

If you could have a look at those as well that would be great.

pguillard’s picture

Thank you.

Remains GotoAction.php Line53, as we encounter an exception for function description
(@ee : https://www.drupal.org/node/1539712#comment-5937986)

pguillard’s picture

Status: Active » Needs review
xjm’s picture

Version: 8.0.x-dev » 8.1.x-dev
Priority: Normal » Minor
Status: Needs review » Postponed

Thanks 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.

xjm’s picture

Assigned: pguillard » Unassigned
xjm’s picture

Issue tags: -Novice
tatarbj’s picture

I've cleaned up the current actions module and attaching the patch file with the changes.

tatarbj’s picture

Assigned: Unassigned » tatarbj
Status: Postponed » Needs review

Status: Needs review » Needs work

The last submitted patch, 18: make_action_module_pass_coder_review-1816682-18.patch, failed testing.

tatarbj’s picture

Sorry, the previous one was checked out from 8.0.x, the current one should be passed.

tatarbj’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 21: make_action_module_pass_coder_review-1816682-19.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 21: make_action_module_pass_coder_review-1816682-19.patch, failed testing.

tatarbj’s picture

Version: 8.1.x-dev » 8.0.x-dev
FileSize
4.04 KB

I'm putting it back to 8.0.x based on this started discussion and send my patch to review.
https://www.drupal.org/node/1518116

tatarbj’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 26: make_action_module_pass_coder_review-1816682-26.patch, failed testing.

tatarbj’s picture

Status: Needs work » Needs review
FileSize
9.12 KB

Sorry for everyone to make noise here, this patch file will work (i really hope)

daffie’s picture

All changes look good to me, accept for this one:

+++ b/core/modules/action/src/Plugin/migrate/source/d6/Action.php
@@ -30,7 +30,7 @@ public function query() {
-    );
+      );

Are you sure about this change?

jaxxed’s picture

I also get this:

FILE: /app/www/active/core/modules/action/action.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
41 | ERROR | Inline doc block comments are not allowed; use "/*
| | Comment */" or "// Comment" instead
----------------------------------------------------------------------

jaxxed’s picture

@daffie : which you're proposed Action.php change, I get a coder issue:

FILE: ...tive/core/modules/action/src/Plugin/migrate/source/d6/Action.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
33 | ERROR | [x] Line indented incorrectly; expected at least 6
| | spaces, found 4
----------------------------------------------------------------------

tatarbj’s picture

Status: Needs work » Fixed

I'm closing the ticket because opened a new one here: #2567357: Make Action module pass Coder Review Please follow it there.

TravisCarden’s picture

Status: Fixed » Needs work

@tatarbj: It's not standard practice to arbitrarily close or duplicate issues. Valuable information, such as comments, subscribers, and relationships to other issues is all lost when you do. See Use the Issue Queue if you don't understand how it works. If you would like to contribute to this issue, please do so here. Thanks!

TravisCarden’s picture

@tatarbj: I just saw #1816690-27: Make Ban module pass Coder Review. The point there was not to re-open closed issues. This issue was still open, so you needn't create a new one. In short: Keep open issues open until fixed. Once fixed, keep closed issues closed. :)

tatarbj’s picture

Assigned: tatarbj » Unassigned
Status: Needs work » Needs review
FileSize
9.78 KB

@TravidCarden i'm confused what should i do @alexpott asked me to close a similar issue and create a new one here: https://www.drupal.org/node/1816690#comment-10313705
Just to make sure: i shouldn't close issues and open a new one if i want to work on a 3+ years and postponed topic which can be solved by me like all of the d8 core modules what i started to do.
In this case i'm attaching the patch what i've created for the duplicated issue #2567357: Make Action module pass Coder Review

TravisCarden’s picture

@tatarbj: The reason @alexpott asked you to open a new issue in #1816690-27: Make Ban module pass Coder Review is because that issue had already been closed. The patch had been committed. The issue was fixed. He was asking you not to re-open closed (fixed) issues. This issue, on the other hand, was already open; so it was appropriate to continue working in it. It should not have been marked fixed because the issue itself was not, in fact, fixed. Does that clear it up? The Status settings of issues handbook page may be of further help, if necessary.

pfrenssen’s picture

pfrenssen’s picture

Status: Needs review » Closed (duplicate)

Closing 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.