Skip to content

buffer-local values for cov-lcov-project-root #62

@orzechowskid

Description

@orzechowskid

hi there,

#60 introduced cov-lcov-project-root as a defvar, but I often find myself working in monorepo projects where different sub-packages have different coverage files in different locations. I'd like to open a PR to define cov-lcov-project-root as buffer-local but I'm not sure what the best way is to accomplish that.

simply changing (defvar cov-lcov-project-root) to (defvar-local cov-lcov-project-root) is not sufficient, because parsing of lcov files is done in a temp buffer (in cov--read-and-parse) which needs access to that variable in order to map lcov SF paths to files on disk (in cov--lcov-parse).

the easiest thing to do would be to modify cov--read-and-parse to check the value of format and, if eq to 'lcov, set some additional buffer-local variables. another solution might be to use something like inheritenv to automatically propagate all buffer-local variables from the user's source buffer into the parser's temp buffer. there are probably other solutions too.

I figured I'd ask for advice before opening a PR, so I don't waste your time reviewing code which isn't what you'd prefer in terms of approach, so any input you had here would be welcome.

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions