diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-06 13:24:54 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-11 10:28:57 +0200 |
commit | 31efa31404801e603286b094c66b7f1f6833ba05 (patch) | |
tree | 501719b3b29f43218d58f90c5960f4adcf593967 /check | |
parent | c7e899f2137391c5db62ff3bc28ed30df444d76a (diff) | |
download | subplot-31efa31404801e603286b094c66b7f1f6833ba05.tar.gz |
test: add a --strict option to ./check to forbid compiler warnings
Diffstat (limited to 'check')
-rwxr-xr-x | check | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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": |