miss_hit
miss_hit copied to clipboard
Add profiles selectable from the commandline
Use case:
- you have a big legacy project and you want to gradually do more and more checking
- you don't want to be overwhelmed
- you have a basic set of things that must pass for absolutely all files, all the time
- you have a few extra things that you want to do for e.g. changed files
Normally you'd run miss_hit like e.g. so:
mh_style .
With this change you can additionally do:
mh_style --profile=strict foo/bar/file.m baz/wibble.m
In the config files you can add profiles like so:
suppress_rule: "line_length"
profile "strict" {
enable_rule: "line_length"
line_length: 80
}
@niklasnylen do you have any thoughts on this? The idea is you can do extra things for e.g. just changed files on checkin.
I think that it would be more useful to specify the different profiles in the "root level" configuration file and then reference the profiles in the subfolder config files. I.e with your profile example in repo/miss_hit.cfg the subfolder config files could contain just the used profile instead of listing the same rule configurations in many different files.
profile: "strict"
It would also be nice to be able to run the analysis of all files with a certain profiles as you described, which would override the subfolder profile setting.
@niklasnylen that might also be a good idea, but I think it should be phrased as templates or defaults.
Configuration works by having a magic object containing all the options. As we go through the directory tree (up to the file we want to analyze) we apply sequentially each config file.
The profiles I imagined would be effectively conditionally applied.
Your idea I think would allow you to pre-declare a blob of statements that can later be executed at wiil. For example you could put this in the root file:
template "potato" {
metric *: disable
metric cyc: limit 10
}
But it would have no effect. But later you can use:
apply template "potato"
And that would be semantically equivalent to
metric *: disable
metric cyc: limit 10