3 #include <boost/program_options.hpp>
6 namespace po = boost::program_options;
14 po::options_description desc(
15 "Runs a set of validators on a map. Think of it like a linter. The following checks are available:");
16 desc.add_options()(
"help,h",
"this help message")
18 (
"map_file", po::value<std::string>(),
"Path to the map to be validated")
20 (
"filter,f", po::value(&config.checksFilter),
21 "Comma separated list of regexes to filter the applicable tests. Will run all tests by default. Example: "
22 "routing_graph.* to run all checks for the routing graph")
24 (
"location,l", po::value(&config.location)->default_value(config.location),
25 "Location of the map (for instanciating the traffic rules), e.g. de for Germany")
27 (
"participants,p", po::value(&config.participants)->composing(),
28 "Participants for which the routing graph will be instanciated (default: vehicle)")
30 (
"lat", po::value(&config.origin.lat)->default_value(config.origin.lat),
31 "latitude coordinate of map origin")
33 (
"lon", po::value(&config.origin.lon)->default_value(config.origin.lon),
34 "longitude coofdinate of map origin")
36 (
"print",
"Only print the checks that will be run, but dont run them");
38 po::positional_options_description pos;
39 pos.add(
"map_file", 1);
40 po::store(po::command_line_parser(argc, argv).options(desc).positional(pos).run(), vm);
42 cfg.
help = vm.count(
"help") != 0;
43 cfg.
print = vm.count(
"print") != 0;
44 if (vm.count(
"map_file") != 0) {
48 std::cout <<
'\n' << desc;
50 std::cout <<
"Please pass either a valid file or '--print' or '--help'!\n";
57 for (
auto& issue : allIssues.errors) {
58 std::cerr << issue <<
'\n';
60 for (
auto& issue : allIssues.warnings) {
61 std::cout << issue <<
'\n';
63 std::cout << allIssues.warnings.size() + allIssues.errors.size() <<
" issues found.\n";
75 std::cout <<
"Will use following checks:\n";
76 for (
auto& check : checks) {
77 std::cout << check <<
'\n';
87 return int(!issues.empty());