Context
While trying to build a/the --exclude/--ignore option to bashcov I am experiencing some difficulties in determining where to start.
Bashcov does not support the --exclude/--ignore option yet, as can be seen from the following output to: bashcov --help:
bashcov --help
Usage: bashcov [options] [--] <command> [options]
Examples:
bashcov ./script.sh
bashcov --skip-uncovered ./script.sh
bashcov -- ./script.sh --some --flags
bashcov --skip-uncovered -- ./script.sh --some --flags
Specific options:
-s, --skip-uncovered Do not report uncovered files
-m, --mute Do not print script output
--bash-path PATH Path to Bash executable
--root PATH Project root directory
--command-name NAME Value to use as SimpleCov.command_name
Common options:
-h, --help Show this message
--version Show version
Motivation
Bashcov includes non-project related files and folders such as the .git folder, and the bats unit test modules in test/libs. This makes it difficult to understand how well the project code itself is actually tested:
For example, the above report shows a 17% coverage, even though of 100% of the custom project bash code lines are tested.
Options
- Bashcov relies on simplecov, so if I could modify bashcov to pass the bashcov
--exclude/--ignorecommands to simplecov, that may be sufficient. I found thebashcovarguments are parsed here. - If Bashcov compiles the list of files to be checked itself, I could modify bashcov to only include those files if they are not within the
--exclude/--ignoredirectories/list. However, I do not yet know whether bashcov does this and if yes where, or whether it relies on simplecov to do that.
Details Option II:
I found this answer that shows how the SimpleCov.start line can be modified to add a filter/exclude list. In bashcov, that SimpleCov.start line can be found here, however I do not yet know how to compile, build and install bashcov locally (without getting the default version from `sudo apt install bashcov on Ubuntu 22.10).
Question
What would be a practical place to start modifying bashcov to build the --exclude/--ignore function?