Skip to content

docs: comment code better to help contributors#437

Merged
ariporad merged 2 commits intomasterfrom
document-code
May 12, 2016
Merged

docs: comment code better to help contributors#437
ariporad merged 2 commits intomasterfrom
document-code

Conversation

@nfischer
Copy link
Copy Markdown
Member

@nfischer nfischer commented May 1, 2016

I realized that our code base can be somewhat confusing in key areas. This should help clarify some of the more confusing parts for other contributors.


// Extract docs from shell.js
var docs = grep('//@', 'shell.js');
var docs = grep('^//@', 'shell.js');
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the regex a bit more specific than what it was before. This lets us have comments like what we see in shell.js line 30:

// The //@include includes the docs for that command

Otherwise, this would attempt to include docs from a file named includes the docs for that command.js (which obviously doesn't exist).

@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented May 9, 2016

@ariporad Let me know if anything here should be changed/updated

shell.js Outdated

//@include ./src/sed
var _sed = require('./src/sed');
var _sed = require('./src/sed'); // don't glob-expand regexes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the // don't glob-expand regexes be on the line below?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I think I put it there just because the line was getting long, but I agree it makes more sense as you suggested.

} else { // and this branch is for everything else
if (args[0] instanceof Object && args[0].constructor.name === 'Object') {
args = args; // object count as options
// a no-op, allowing the syntax `touch({'-r': file}, ...)`
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ariporad is this different from what you had in mind?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, looks great.

@ariporad
Copy link
Copy Markdown
Contributor

LGTM

@ariporad ariporad merged commit 57a9be2 into master May 12, 2016
@nfischer nfischer deleted the document-code branch May 12, 2016 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants