coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Custom file mapper - plugin or config function

Open spuliaiev-sfdc opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. We have a repository with a lot of python files, and some of the files are just sym-links to other files. We would like to have our custom file mapper which will map them and create combine report for the real files, as parts are used in different utilities generated from this repo.

Describe the solution you'd like File Mapper plugin which would improve the following code to add a bit of flexibility: https://github.com/nedbat/coveragepy/blob/master/coverage/control.py#L290

        set_relative_directory()
        self._file_mapper = relative_filename if self.config.relative_files else abs_file

Describe alternatives you've considered Override the post-processing and rewrite either coverage._file_map or SQLite file.

spuliaiev-sfdc avatar Feb 09 '22 20:02 spuliaiev-sfdc

BTW - I do not see a way to set up config.relative_files other then the config file. Why it is not allowed using the Coverage arguments?

spuliaiev-sfdc avatar Feb 09 '22 20:02 spuliaiev-sfdc

Hi, sorry I've let this wait for so long. Can you tell me more about your arrangement? Can you link to your repo? What would your custom file mapper do exactly?

BTW - I do not see a way to set up config.relative_files other then the config file. Why it is not allowed using the Coverage arguments?

There are many options that are not supported on the command line. I didn't want to clutter the command line options, and people usually have a configuration file they can use (.coveragerc, setup.cfg, tox.ini, or pyproject.toml). Do you have none of those?

nedbat avatar Nov 13 '22 12:11 nedbat