<#20898 Consistent option hierarchy > Issue create...
# github-notifications
c
#20898 Consistent option hierarchy Issue created by grihabor The problems Right now
Subsystem
options,
Goal
options and
Target
fields are unrelated and therefore inconsistent. This means that every backend has to define it's own options for all the levels and make sure they all work together nicely. Problems with
--filter
Simple filtering on cli works:
Copy code
pants lint --filter-target-type=python_source ::
Now imagine you want to do the same thing in
pants.toml
, how do you do that? I would expect this to work:
Copy code
[lint]
filter-target-type = ["python_source"]
But it doesn't, because
lint
goal doesn't have
filter-target-type
option, for some reason
filter
is a subsystem of it's own:
Copy code
[filter]
target_type = ["python_source"]
This means you can't control individual goals filter options. Problems with
skip
Filtering linters to run happens on all 3 layers of options. To choose one single linter in CLI you can use
only
option in
lint
goal subsystem:
Copy code
pants lint --only=shfmt ::
To skip one single linter it has to implement
skip
option in it's own subsystem:
Copy code
pants lint --shfmt-skip ::
To skip one single target the target itself has to implement
skip
field:
Copy code
shell_sources(skip_shfmt=True)
Inconsistencies between options and fields In general, there are many options that are present in subsystem, but missing in the target, and vise versa. For example, there is a verbosity option in
pex
subsystem, but the option is missing in
pex_binary
. On the other hand
pex_binary
has `layout` field that is missing in
pex
subsystem. Environments This inconsistency probably involves interaction with environments too. The solution Not sure how to fix it, but it will probably require redesigning a bunch of pieces including core into a sound option hierarchy. TODO pantsbuild/pants