Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: harden plugins against unknown options #804

Merged
merged 1 commit into from Nov 16, 2017
Merged

Conversation

nfischer
Copy link
Member

This reworks the plugin API such that:

  • Unable to register a command with unknown wrap-options
  • TypeError raised for wrap-option type mistakes
  • Remove the overWrite option (it's unused, probably safest to not
    expose for now)
  • cmdOptions defaults to null instead of false for type
    consistency (no change to default behavior)
  • Move pipeMethods logic into _register, since it makes more sense
    there

This is not expected to have any effect on existing plugins.

This reworks the plugin API such that:

 - Unable to register a command with unknown wrap-options
 - `TypeError` raised for wrap-option type mistakes
 - Remove the `overWrite` option (it's unused, probably safest to not
   expose for now)
 - `cmdOptions` defaults to `null` instead of `false` for type
   consistency (no change to default behavior)
 - Move `pipeMethods` logic into `_register`, since it makes more sense
   there

This is not expected to have any effect on existing plugins.
@codecov-io
Copy link

codecov-io commented Nov 12, 2017

Codecov Report

Merging #804 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #804      +/-   ##
==========================================
+ Coverage   95.47%   95.49%   +0.01%     
==========================================
  Files          34       34              
  Lines        1260     1265       +5     
==========================================
+ Hits         1203     1208       +5     
  Misses         57       57
Impacted Files Coverage Δ
src/common.js 98.39% <100%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6189d7f...d578203. Read the comment docs.

wrapOutput: true,
overWrite: false,
unix: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the source, unix is only used by exec, because exec args differ from the other commands. I think now would be a good chance to improve this.

It makes sense to expose the ability to skip manipulating the args, so let's rename the option to make that clearer. Something like preserveArgs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was planning to hide the unix option in a later PR. Renaming is ok too, but I don't see a need to expose it (we already offer ways to disable globbing and option parsing, which are the most expensive argument manipulations).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, that's fine.

@freitagbr
Copy link
Contributor

LGTM

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.

None yet

3 participants