Some functions in features don't have sufficient or accurate doc comments.

We want accurate type information on @param and @return docs, so that IDEs can assist with code verification.
We also want good explanations to improve DX.

Better compliance with Drupal coding standards is also a criterion, but the major goal is DX.

Feature branch

See https://github.com/donquixote/drupal-features/compare/issue-3060511-7x2x...
Patches in this issue are only for testbot.

EDIT: After pm with @mpotter, we decided to commit this as one big change. Local development happens in a feature branch, but in the end it is all squashed.

Scope

The goal is for all (exceptions below) function docs to
- have the most accurate type information possible for IDEs to consume
- have accurate descriptions on the function itself and its parameters
- any modified doc comment should be compliant with DCS, as far as it makes sense

A few minor changes in other docs outside of the function docs are included as well.

Not included:
- Anything that would change the code itself, instead of just the docs.
- Docs on hook implementations. These are dealt with in their own dedicated issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

donquixote created an issue. See original summary.

donquixote’s picture

Status: Active » Needs review
FileSize
4.48 KB

I suggest to apply this patch with "git am" or "git am --signoff" to get all the commit messages.

  • donquixote committed 27fdc6f on issue-3060511-7x2x-some-doc-enhancements
    Issue #3060511: (CS) Enhance doc comment on features_export_render().
    
  • donquixote committed 48bbe8d on issue-3060511-7x2x-some-doc-enhancements
    Issue #3060511: (CS) Enhance doc comment on...
  • donquixote committed 48cc8e0 on issue-3060511-7x2x-some-doc-enhancements
    Issue #3060511: (CS) Enhance doc comment on _features_populate().
    
  • donquixote committed bdb744f on issue-3060511-7x2x-some-doc-enhancements
    Issue #3060511: (CS) Enhance doc comment on features_populate().
    

  • donquixote committed 8c00122 on issue-3060511-docs-on-hook-implementations
    Issue #3060511: (doc) Add @param docs on dependencies_features_export()...
  • donquixote committed c5183a3 on issue-3060511-docs-on-hook-implementations
    Issue #3060511: (doc) Enhance doc comments on features_modules_enabled...
  • donquixote committed 1207ef9 on issue-3060511-inline-see-for-callbacks
    Issue #3060511: (doc) Add @see comments on function name strings in...
  • donquixote committed 16177a9 on issue-3060511-inline-see-for-callbacks
    Issue #3060511: (doc) Add @see comments on drush command definitions, to...
donquixote’s picture

UPDATE
A lot more is coming.
I just need to do some fine-tuning, and group the commits. 147+ commits is a bit much :)

donquixote’s picture

Moar better!
I have this as a branch with many commits, but I am uploading it as a single patch to hit the testbot.

donquixote’s picture

Title: Enhance some doc comments in features. » Enhance (function) doc comments in features.
Issue summary: View changes
donquixote’s picture

I used the wrong diff format :)

donquixote’s picture

994 coding standards messages
✗ 164 more than branch result

I might do something about this..
The main goal is DX, not compliance. But if I am already there, I should do it in a way that increases compliance.

donquixote’s picture

Another attempt, more compliant with Drupal CS.
I do not attempt full compliance, there is just too much in the code that I don't want to touch. I just want my own changes to not introduce new CS problems.
If some still slip through, that's ok, we will survive it.

donquixote’s picture

Issue summary: View changes
donquixote’s picture

118 more than branch result

:(
I could use phpcbf, but I don't want so much disruption and scope creep in the entire files. I only want to fix those places where I modified the doc.
I will find a solution :)

donquixote’s picture

118 more than branch result

Looks like this is mostly missing @param doc text, for parameters that were not documented at all before.
I have three options:
1. Do NOT add the @param docs. -> bad.
2. Do add the @param docs, but no doc text, unless/until I have something to say. -> bad for compliance, but good for DX and for the IDE, and easy to do.
3. Do add the @param docs with poor quality doc text. -> risk of useless or misleading text.
4. Do add the @param docs with accurate doc text. -> risk to waste a lot of time.

In my own projects I always opt for option 2, this gives me the option to upgrade later.
I think I am going for this as well here.

donquixote’s picture

This time I think phpcs will be happier.

I created a variation of the Drupal CS that only checks docs.
Some existing CS issues in docs will be dealt with in follow-up issues. Especially everything in hooks implementations.

At least this way I don't introduce CS regressions.

donquixote’s picture

donquixote’s picture

751 coding standards messages
✓ 104 fewer than branch result

This seems acceptable to me!

donquixote’s picture

Issue summary: View changes

  • donquixote committed dd0368d on 7.x-2.x
    Issue #3060511 by donquixote: Enhance (function) doc comments in...
donquixote’s picture

Status: Needs review » Fixed

Committed. Let's move on!

If anyone finds objections with some of the changes, open a new issue!

Status: Fixed » Closed (fixed)

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

donquixote’s picture

I already found one mistake, which will need a follow-up.

On _drush_features_component_filter() we now have a garbled param comment text on the $options parameter.