summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2021-03-11 08:34:13 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2021-03-11 08:34:13 +0000
commitf9b5ebeec83204bf9ae5716a9956fa461bf6c250 (patch)
tree501719b3b29f43218d58f90c5960f4adcf593967
parentc7e899f2137391c5db62ff3bc28ed30df444d76a (diff)
parent31efa31404801e603286b094c66b7f1f6833ba05 (diff)
downloadsubplot-f9b5ebeec83204bf9ae5716a9956fa461bf6c250.tar.gz
Merge branch 'warnings-as-errors' into 'main'
test: add a --strict option to ./check to forbid compiler warnings Closes #162 See merge request larswirzenius/subplot!143
-rwxr-xr-xcheck14
1 files 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":