Note this only applies to Rules in Drupal 7 - Rules in Drupal 8 complies with current coding standards and patches are required to be free of new standards violations before they are committed.

Rules 7.x-2.x however was written under a previous set of coding standards - Drupal core has changed standards drastically since then, with many new standards aimed primarily at D8 code. Drupal core policy is this:

All new code should follow the current standards, regardless of (core) version. Existing code in older versions may be updated, but doesn't necessarily have to be. Especially for larger code-bases (like Drupal core), updating the code of a previous version for the current standards may be too huge of a task. However, code in current versions should follow the current standards.

There are more reasons than just "may be too huge of a task" to leave the 7.x-2.x code mostly untouched - modifying class names, variable names, etc. has a great potential to break code and break contributed modules that integrate with Rules. Likewise, coding standards patches touch many parts of the code base, so have a great potential to break other work-in-progress patches that address real problems (bug reports) or make real improvements (feature requests) - coding standards changes are extremely minor in importance related to these.

Because of this, I am not interested in putting in a lot of effort to change anything EXCEPT for things that may / are known to cause problems (like extra whitespace or missing EOL at ends of files) and things that will actually HELP people who use Rules (like missing or incomplete documentation comments).

If you would like to submit patches here, make sure they are restricted to one and only one type of standards violation - that will make them easier to review. Also, don't spend effort in reformatting code - restrict yourself to the the two categories I mentioned above.

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new1.66 KB

This patch fixes "Expected 1 newline at end of file" errors

tr’s picture

Related issue #2382927: taxonomy.rules.inc provides a class and has no files[] entry in rules.info - the resolution of that will fix "It's only necessary to declare files[] if they declare a class or interface." errors.

tr’s picture

StatusFileSize
new2.06 KB

Re-roll of #1, because I missed one occurrence.

  • TR committed 58481d2 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Expected 1 newline at end...
tr’s picture

StatusFileSize
new28.3 KB

This patch fixes "Visibility must be declared on method" and ensures that declared visibilities are correct.

tr’s picture

StatusFileSize
new1.08 KB

This patch changes true to TRUE in a few places.

  • TR committed 68e08c7 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Fixes "Visibility must be...
  • TR committed 6fefb24 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Use TRUE not true
    
tr’s picture

Committed #6 and #7.

tr’s picture

StatusFileSize
new53.39 KB

Whitespace.

  • TR committed b9f71d9 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Whitepspace
    
tr’s picture

StatusFileSize
new19.07 KB

Array fixes - whitespace, commas, indentation.

  • TR committed f7c28f4 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Array fixes - whitespace,...
tr’s picture

StatusFileSize
new31.91 KB

Punctuation.
Make @todo, @todo:, TODO, @TODO comments uniform so they are easier to search for.

  • TR committed 87f179c on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Punctuation. Make @todo, @...
tr’s picture

StatusFileSize
new1.85 KB

"The $text argument to l() should be enclosed within t() so that it is translatable"

  • TR committed 48bb2e5 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: The $text argument to l()...
tr’s picture

StatusFileSize
new16.45 KB

"Expected 1 blank line before function"

  • TR committed 21e4e37 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Expected 1 blank line...
tr’s picture

Status: Needs review » Active

Committed #18.

tr’s picture

Status: Active » Needs review
StatusFileSize
new838 bytes

CSS coding standards and validation.

  • TR committed 43fce2f on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - CSS coding standards and...
tr’s picture

Status: Needs review » Active

Committed #21.

  • TR committed 45dde01 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards: Fix some documentation (non...
tr’s picture

Status: Active » Needs review
StatusFileSize
new10.5 KB

This patch addresses some of these violations:

  • There must not be more than one property declared per statement
  • Return type missing for @return tag in function comment
  • The @see reference should not contain any additional text

  • TR committed 7279bcc on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - misc. doxygen comment...
tr’s picture

Status: Needs review » Active
tr’s picture

Status: Active » Needs review
StatusFileSize
new25.57 KB

Added some missing function doc comments, some missing @param and @return comments and some missing type information on @param and @return comments, fixed some whitespace issues and a few multivalue arrays missing a , after the last item.

  • TR committed 5e96fce on 7.x-2.x
    Issue #2990280-28 by TR: [D7] Coding standards - Added some missing...
tr’s picture

Status: Needs review » Active
tr’s picture

Status: Active » Needs review
StatusFileSize
new45.65 KB

This patch fixes most occurrences the following coding standards violations:

  1. Doc comment short description must be on the first line
  2. Doc comment short description must be on a single line, further text should be a separate paragraph

Documentation changes only.

tr’s picture

Status: Needs review » Active

Committed.

tr’s picture

Status: Active » Needs review
StatusFileSize
new25.11 KB

This patch adds types to some @param and @return doc comments, corrects some syntactically wrong @param and @return comments, adds some missing @param and @return comments, and adds some missing function doc comments.

tr’s picture

Status: Needs review » Active

Committed #33.

  • TR committed 68abe8b on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - comment #33. Fixed some @...
tr’s picture

Status: Active » Needs review
StatusFileSize
new25.9 KB

More typing in @param and @return doc comments, added some @var comments and more missing function/parameter comments. Fixed some array wrapping.

  • TR committed 01dd273 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - comment #33. Fixed some @...
tr’s picture

Status: Needs review » Active

Committed #36

tr’s picture

StatusFileSize
new20.38 KB

Mostly adding some missing function docs. Also correcting some comments and some line-length issues.

  • TR committed fb8b0f1 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - Mostly adding some missing...
tr’s picture

Committed.

tr’s picture

Status: Active » Needs review
StatusFileSize
new18.54 KB

More doxygen comment work (missing types mostly) and missing function comments. Some corrected in-line comments.

  • TR committed dc2dd24 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - More doxygen comment work...
tr’s picture

Status: Needs review » Active

Committed.

tr’s picture

StatusFileSize
new25.23 KB

More documentation comments, including @param, @return, @var.

tr’s picture

StatusFileSize
new25.21 KB

I mixed in one line from another patch, causing test failures. That's why we test before commit ...

Here's a corrected version of #45

  • TR committed f880a18 on 7.x-2.x
    Issue #2990280-46 by TR: [D7] Coding standards - More documentation...
tr’s picture

StatusFileSize
new34.03 KB

More fixes in preparation for a new D7 release. Indentation and missing documentation.

And out of curiosity I've tested against PHP 7.4 as well. I know Drupal core doesn't completely support PHP 7.4 at this point in time, but I would like to see if the tests flag any problems in the Rules code. I expect some test fails due to core.

  • TR committed bf7d3c6 on 7.x-2.x
    Issue #2990280 by TR: [D7] Coding standards - documentation and...
tr’s picture

Status: Active » Fixed

The PHP 7.4 fails seem to all come from core.

Committed #48. I'm closing this issue because I think most of the remaining issues are "won't fix" and because I don't see a need to keep this open any more just in case someone else should want to work on it.

If you're inclined to fix some of the remaining missing documentation warning or other standards, please open a new issue.

Status: Fixed » Closed (fixed)

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