diff options
author | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2023-04-25 08:59:23 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2023-04-25 08:59:23 +0000 |
commit | 3b9b50bf7783f2d1f8bf0b3dd720f38db21b6ef6 (patch) | |
tree | 4b0fd32a2b85d44c74002375f845d2347cf7a491 | |
parent | 1ff43a151c1b650ee0f82bc753183eb4dce82d05 (diff) | |
parent | 814fce93e34a1f5981b9afcc38c97b3f4b7d52da (diff) | |
download | subplot-3b9b50bf7783f2d1f8bf0b3dd720f38db21b6ef6.tar.gz |
Merge branch 'liw/msrv-checks' into 'main'
tests: don't check formatting or clippy in MSRV CI job
See merge request subplot/subplot!323
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rwxr-xr-x | check | 12 | ||||
-rw-r--r-- | src/codegen.rs | 6 |
3 files changed, 12 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 303f043..16b7171 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,4 +16,4 @@ check-msrv: - sudo apt update - sudo apt -y build-dep . - rustup default 1.63 - - ./check -v + - ./check -v --sloppy @@ -231,13 +231,13 @@ def check_shell(r): r.runcmd_maybe(["shellcheck"] + sh) -def check_rust(r, strict=False): +def check_rust(r, strict=False, sloppy=False): """Run all checks for Rust code""" r.title("checking Rust code") r.runcmd(["cargo", "build", "--workspace", "--all-targets"]) - if r.got_cargo("clippy"): + if r.got_cargo("clippy") and not sloppy: argv = [ "cargo", "clippy", @@ -254,7 +254,8 @@ def check_rust(r, strict=False): sys.exit("Strict Rust checks specified, but clippy was not found") r.runcmd(["cargo", "test", "--workspace"]) - r.runcmd(["cargo", "fmt", "--", "--check"]) + if not sloppy: + r.runcmd(["cargo", "fmt", "--", "--check"]) def check_subplots(r): @@ -360,6 +361,9 @@ def parse_args(): p.add_argument( "--strict", action="store_true", help="don't allow compiler warnings" ) + p.add_argument( + "--sloppy", action="store_true", help="don't check formatting or with clippy" + ) all_whats = ["tooling", "python", "shell", "rust", "subplots"] p.add_argument( @@ -391,7 +395,7 @@ def main(): elif what == "shell": check_shell(r) elif what == "rust": - check_rust(r, strict=args.strict) + check_rust(r, strict=args.strict, sloppy=args.sloppy) elif what == "subplots": check_subplots(r) elif what == "tooling": diff --git a/src/codegen.rs b/src/codegen.rs index 9f346a9..dfe4e1f 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -170,10 +170,10 @@ mod test { #[test] fn verify_name_slugification() { static GOOD_CASES: &[(&str, &str)] = &[ - ("foobar", "foobar"), // Simple words pass through - ("FooBar", "foobar"), // Capital letters are lowercased + ("foobar", "foobar"), // Simple words pass through + ("FooBar", "foobar"), // Capital letters are lowercased ("Motörhead", "mot_rhead"), // Non-ascii characters are changed for underscores - ("foo bar", "foo_bar"), // As is whitespace etc. + ("foo bar", "foo_bar"), // As is whitespace etc. ]; for (input, output) in GOOD_CASES.iter().copied() { let input = Value::from(input); |