Enforce that an option name isn't registered twice in a scope.

Review Request #3695 — Created April 15, 2016 and submitted

benjyw
pants
pants-reviews
nhoward_tw, stuhood, wisechengyi

Amazingly, we didn't check for this before, at least not since we
got rid of our use of argparse.

This commit fixes the one case where we actually did double-register.
The fix required a bit of a hack in export.py, but there's a TODO for that,
and we need to revisit export.py anyway
(see https://github.com/pantsbuild/pants/issues/3200).

CI passes: https://travis-ci.org/pantsbuild/pants/builds/123318109

  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
  1. ping?

  2. 
      
  1. 
      
  2. NailgunClass does not seem to be an actual class, do you mean NailgunTaskBase?

    1. D'oh! I meant NailgunTask, thanks!

  3. 
      
  1. 
      
  2. src/python/pants/option/parser.py (Diff revision 2)
     
     
     

    Could this be a set intersection maybe?

    1. It could, but it would be less efficient, as args is almost always of cardinality 1, and very rarely of cardinality 2, never 3 or more (in practice). Also, if we use a set intersection then we have to pick a member of the intersection to use in the error message, and unless we use an OrderedSet that may not be the first member (which is the one the user will be most familiar with). It's more machinery than we need for this.

  3. 
      
Review request changed

Status: Closed (submitted)

Change Summary:

930b0480b447d06a292f9417ef77485b9492bacb

Loading...