coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

add command line option to show current configuration

Open smcavallo opened this issue 4 years ago • 4 comments

It's useful to be able to determine in advance of running an analysis what the current configuration is. This adds support for exposing the end resulting configuration via cmd ex. coverage config --show-omit -o json

Signed-off-by: smcavallo [email protected]

smcavallo avatar Feb 05 '21 18:02 smcavallo

Thanks for the pull request. I haven't tried running it, but isn't this similar to what coverage debug config shows? If so, maybe we need to make it more apparent in the docs?

nedbat avatar Feb 06 '21 12:02 nedbat

Thanks for the pull request. I haven't tried running it, but isn't this similar to what coverage debug config shows? If so, maybe we need to make it more apparent in the docs?

Yes, thank you!!! I didn't know that existed. Very similar to what we are looking for. We'd like to be able to:

  • Select a specific section of the config to query. Ex. coverage debug config run_omit
  • Have more control over the output format. Ex. coverage debug config run_omit -o json

Our use case is that we are using multiple code coverage tools, coveragepy being the primary and "source of truth." We need to use a consistent set of rules across all the tools. We need to be able to query the coveragepy rules in order to "share" those rules with our other downstream python linters and quality gates. It would be easier if those other tools had native support for reading coveragepy files but they don't and I'm not sure it would make sense for them to know all the logic of how to do that anyways. We are looking for a way to get the exclusion rules from coveragepy in a format we can easily parse. I can add those additional command line options to coverage debug config if that's the best route and you would accept that contribution.

smcavallo avatar Feb 06 '21 13:02 smcavallo

I can see the value of parseable output from coverage debug config. I don't think I'd want to add a way to select the section to output though: once you have json output, the filtering can be done downstream.

nedbat avatar Feb 06 '21 17:02 nedbat

Is this still valid?

ProsperousHeart avatar Mar 20 '23 19:03 ProsperousHeart