Skip to content

Commit

Permalink
Ability to add exclusions to grcov
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Retunsky committed Aug 18, 2020
1 parent d9881ad commit 64834ca
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ ignore:
path-mapping:
- "/path1"
- "/path2"
excl-br-line: "#\[(derive(.*)\]"
excl-br-start: "#\[test\]"
excl-br-stop: "cov:excl-br-stop"
excl-line: "cov:excl-line"
excl-start: "mod test"
excl-stop: "cov:excl-stop"
```

## Notes
Expand Down
24 changes: 24 additions & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export interface User {
pathMapping?: string[],
prefixDir?: string,
outputPath?: string,
excl_br_line?: string,
excl_br_start?: string,
excl_br_stop?: string,
excl_line?: string,
excl_start?: string,
excl_stop?: string,
}

/**
Expand Down Expand Up @@ -125,6 +131,24 @@ async function loadUser(path: string): Promise<User> {
if (contents['prefix-dir']) {
user.prefixDir = contents['prefix-dir'];
}
if (contents['excl-br-line']) {
user.excl_br_line = contents['excl-br-line'];
}
if (contents['excl-br-start']) {
user.excl_br_start = contents['excl-br-start'];
}
if (contents['excl-br-stop']) {
user.excl_br_stop = contents['excl-br-stop'];
}
if (contents['excl-line']) {
user.excl_line = contents['excl-line'];
}
if (contents['excl-start']) {
user.excl_start = contents['excl-start'];
}
if (contents['excl-stop']) {
user.excl_stop = contents['excl-stop'];
}
if (contents['output-path']) {
user.outputPath = contents['output-path'];
} else if (contents['output-file']) {
Expand Down
30 changes: 30 additions & 0 deletions src/grcov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,36 @@ export class Grcov {
args.push(config.user.prefixDir);
}

if (config.user.excl_br_line) {
args.push('--excl-br-line');
args.push(config.user.excl_br_line);
}

if (config.user.excl_br_start) {
args.push('--excl-br-start');
args.push(config.user.excl_br_start);
}

if (config.user.excl_br_stop) {
args.push('--excl-br-stop');
args.push(config.user.excl_br_stop);
}

if (config.user.excl_line) {
args.push('--excl-line');
args.push(config.user.excl_line);
}

if (config.user.excl_start) {
args.push('--excl-start');
args.push(config.user.excl_start);
}

if (config.user.excl_stop) {
args.push('--excl-stop');
args.push(config.user.excl_stop);
}

// TODO:
// args.push('--service-job-number');
// args.push('');
Expand Down

0 comments on commit 64834ca

Please sign in to comment.