shouldRun

Checks whether a module is part of a user-specified include/exclude list. The user can specify a comma-separated list of filters, everyone needs to start with either a '+' (inclusion) or '-' (exclusion). If no includes are specified, all modules are included.

bool
shouldRun
(
check : BaseAnalyzer
)

Examples

bool test(string moduleName, string filters)
{
	StaticAnalysisConfig config;
	// it doesn't matter which check we test here
	config.asm_style_check = Check.enabled;
	// this is done automatically by inifiled
	config.filters.asm_style_check = filters.split(",");
	return shouldRun!AsmStyleCheck(moduleName, config);
}

// test inclusion
assert(test("std.foo", "+std."));
// partial matches are ok
assert(test("std.foo", "+bar,+foo"));
// full as well
assert(test("std.foo", "+bar,+std.foo,+foo"));
// mismatch
assert(!test("std.foo", "+bar,+banana"));

// test exclusion
assert(!test("std.foo", "-std."));
assert(!test("std.foo", "-bar,-std.foo"));
assert(!test("std.foo", "-bar,-foo"));
// mismatch
assert(test("std.foo", "-bar,-banana"));

// test combination (exclusion has precedence)
assert(!test("std.foo", "+foo,-foo"));
assert(test("std.foo", "+foo,-bar"));
assert(test("std.bar.foo", "-barr,+bar"));

Meta