• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 7624
0%
main: 93%

Build:
Build:
LAST BUILD BRANCH: go-pin-gotoolchain
DEFAULT BRANCH: main
Ran 25 Oct 2015 02:06AM UTC
Jobs 8
Files 0
Run time –
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
7624

push

travis-ci

benjyw
Prevent option shadowing.

It was unused (at least deliberately, see below...), confusing, and
required some complicated logic to support.

Highlights:

- Simplifies `OptionValueContainer`. We still need some magic to support
  ranked values, but we no longer need option forwarding magic, which
  was a big part of the complication in that file. Now, instead of its
  own logic being largely (and complicatedly) implemented in terms of
  hasattr/setattr/getattr, it simply wraps a key->rankedvalue dict,
  and there's a small wrapper of `__getattr__`/`__setattr__` magic, just to
  support direct attribute access.

- Also removes the ability to access an option's value by any of its registered
  aliases. This wasn't used in practice, and complicated the code needlessly.
  So for example, in the rare case where we register an option with two names, say
  `-f`, `--foo`, we can now only access the value as `opts.foo`, not `opts.f`. But
  we have almost no such options anyway, so this is hardly important.  Now you
  must access the option by its 'dest' name, as determined by argparse, namely
  the first name in the registration list with len(name) > 1.

- We now detect attempts to shadow options, and error out on them.
  Unfortunately, we had quite a few unintentional shadowed options in
  the codebase (and some of these were quite confusing, so it's a good
  thing we got rid of them). Each such case was fixed by one of the
  following means:

    * Renaming the option.

    * Deferring to the global option of the same name (in some cases
    making that option recursive). This meant expanding the meaning of
    the global option, but in a sensible way.  E.g., previously the
    global `--fail-fast` meant "fail fast on parsing", but now it means
    "fail fast in whatever way makes sense to the code using the option".

    * Removing the inner option.  E.g., the filter task had a `--tag` option that
    wasn't necessary: the global `--tag` option already filters targets
    by tags, and the task had a more general `--tag-regex` option already.

    * Removing the outer option.  Specifically, since so many tasks register
    a `--version` option, it made no sense for the global scope to hog that
    option name for itself. So now only `-V` and `--pants-version` work for
    getting the version of pants itself.  Seems reasonable, especially since
    you already had to use `pants_version` in config, due to some special-casing.

    * Changing task registration names. E.g., the `JvmBundle` task was
    registered as `bundle` under goal `bundle`, meaning that its
    options scope was `bundle.bundle`, elided to just `bundle`.
    Which meant that any other task in the `bundle` goal could shadow its options.
    Renaming the task to `bundle.jvm` fixes this issue, and is also
    a good idea anyway. There's no reason to privilege JVM in this way.

  Note that unfortunately it was not feasible to do a deprecation cycle
  on these option changes, as they interact with the code in subtle ways,
  and getting deprecation right would have been a lot of work.
  However they were mostly config-only options, and `migrate_config.py` should
  deal with them.  When this rolls out, repo owners are going to have
  to pay extra attention to potential issues in their repos, but that
  was going to be true anyway, no matter how this change shaped up.

Testing Done:
CI passes: https://travis-ci.org/pantsbuild/pants/builds/87215317

Reviewed at https://rbcommons.com/s/twitter/r/3035/
Jobs
ID Job ID Ran Files Coverage
1 7624.1 (CI_FLAGS="-cjlpn 'Various pants self checks'") 25 Oct 2015 02:06AM UTC 0
Travis Job 7624.1
4 7624.4 (CI_FLAGS="-fkmsrcjlp 'Python contrib tests'") 25 Oct 2015 02:08AM UTC 0
Travis Job 7624.4
5 7624.5 (CI_FLAGS="-fkmsrjlpn -i 0/6 'Python integration tests for pants - shard 1'") 25 Oct 2015 02:06AM UTC 0
Travis Job 7624.5
6 7624.6 (CI_FLAGS="-fkmsrjlpn -i 1/6 'Python integration tests for pants - shard 2'") 25 Oct 2015 02:14AM UTC 0
Travis Job 7624.6
7 7624.7 (CI_FLAGS="-fkmsrjlpn -i 2/6 'Python integration tests for pants - shard 3'") 25 Oct 2015 02:14AM UTC 0
Travis Job 7624.7
8 7624.8 (CI_FLAGS="-fkmsrjlpn -i 3/6 'Python integration tests for pants - shard 4'") 25 Oct 2015 02:15AM UTC 0
Travis Job 7624.8
9 7624.9 (CI_FLAGS="-fkmsrjlpn -i 4/6 'Python integration tests for pants - shard 5'") 25 Oct 2015 02:18AM UTC 0
Travis Job 7624.9
10 7624.10 (CI_FLAGS="-fkmsrjlpn -i 5/6 'Python integration tests for pants - shard 6'") 25 Oct 2015 02:15AM UTC 0
Travis Job 7624.10
Source Files on build 7624
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #7624
  • 9c2fc477 on github
  • Prev Build on master (#7622)
  • Next Build on master (#7629)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc