From 31efa31404801e603286b094c66b7f1f6833ba05 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 6 Mar 2021 13:24:54 +0200 Subject: test: add a --strict option to ./check to forbid compiler warnings --- check | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/check b/check index 2573a9e..5dc60ed 100755 --- a/check +++ b/check @@ -165,13 +165,18 @@ def check_shell(r): r.runcmd_maybe(["shellcheck"] + sh) -def check_rust(r): +def check_rust(r, strict=False): """Run all checks for Rust code""" r.title("checking Rust code") r.runcmd(["cargo", "build", "--all-targets"]) if r.got_cargo("clippy"): - r.runcmd(["cargo", "clippy"]) + if strict: + r.runcmd(["cargo", "clippy", "--all-targets", "--", "-D", "warnings"]) + else: + r.runcmd(["cargo", "clippy", "--all-targets"]) + elif strict: + sys.exit("Strict Rust checks specified, but clippy was not found") r.runcmd(["cargo", "test"]) r.runcmd(["cargo", "fmt"]) @@ -250,6 +255,9 @@ def parse_args(): p.add_argument( "-p", dest="progress", action="store_true", help="print some progress output" ) + p.add_argument( + "--strict", action="store_true", help="don't allow compiler warnings" + ) all_whats = ["python", "shell", "rust", "subplots", "subplotlib"] p.add_argument( @@ -270,7 +278,7 @@ def main(): elif what == "shell": check_shell(r) elif what == "rust": - check_rust(r) + check_rust(r, strict=args.strict) elif what == "subplots": check_subplots(r) elif what == "subplotlib": -- cgit v1.2.1