0

My project uses FoundationPress, a WordPress starter theme. I use Github and update my project from the parent repository with an upstream remote when the community improves the code. For the record, I've programmed a long time but almost always alone, and I'm very inexperienced with docblocks and in-code documentation. I know to some extent this may be opinion based as that seems to be the trend searching other answers, but I feel like I'm not grasping proper usage.

The parent project uses PHP Docblocks that look like this on PHP files, always only once per file, for example:

/**
 * Brief File Description
 *
 * @package FoundationPress
 * @since FoundationPress 1.0.0
 */

When I add new PHP files of my own, I've been adding a similar block but using the name for my project instead:

/**
 * Brief File Description
 *
 * @package MyProject
 * @since MyProject 0.1.0
 */

Sometimes, I update an existing file with my own functions. I've been putting @since above those functions, so it is like this:

/**
 * Brief File Description
 *
 * @package FoundationPress
 * @since FoundationPress 1.0.0
 */

function foo() { ... }

function bar() { ... }

/**
 * My Function Description 
 *
 * @since MyProject 0.1.0
*/
function my_foo() { ... }

Other times, I update an existing function - I just leave the docblock alone for those, but I wonder if I should be updating anything.

  1. Is there a best practice or at least commonly accepted way to handle this situation (a forked project that is keeping up to date with its parent repository) so my code is more useful to other programmers?
  2. There seem to be a lot of other docblock parameters and options, like docblocks for every function. Is there a recommended level of detail I should strive for?
  3. Is there a best practice for also adding similar documentation on other kinds of files (SCSS, JS, etc) in my project? The parent project doesn't seem to have any, but I'd be interested in adding some.

My goal is to create code & in-code documentation in a format that coworkers or future maintainers may find useful in the future.

digiacom
  • 50
  • 1
  • 1
  • 6
  • Best practice would be not to modify thrid party code at all. If you need to update FoundationPress (security patches etc.), you would need to add modifications again. And who knows, maybe they add methods that's called the same as your added ones? – M. Eriksson Jan 10 '19 at 18:47
  • Hmm, FoundationPress is a WordPress starter theme, that is intended to be altered to create WordPress themes. I always check the differences before merging upstream changes, so I don't lose any of my own modifications or compatibility. – digiacom Jan 10 '19 at 18:57
  • Can't you just create a child theme for it? – M. Eriksson Jan 10 '19 at 18:58
  • FoundationPress uses a sass-based workflow intended to be compiled via npm ([repo on github](https://github.com/olefredrik/FoundationPress)), not extended via a child theme. It is not the 'WordPress way' so to speak, so I didn't tag this question with WordPress. – digiacom Jan 10 '19 at 19:05

0 Answers0