From 7457498ea64c4542b501d4c03ec2ff617763b070 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 30 Jan 2022 12:30:51 +0530 Subject: new lint: deprecated_to_path --- bin/tests/data/deprecated_to_path.nix | 6 ++++ bin/tests/main.rs | 3 +- bin/tests/snapshots/main__deprecated_to_path.snap | 34 +++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 bin/tests/data/deprecated_to_path.nix create mode 100644 bin/tests/snapshots/main__deprecated_to_path.snap (limited to 'bin/tests') diff --git a/bin/tests/data/deprecated_to_path.nix b/bin/tests/data/deprecated_to_path.nix new file mode 100644 index 0000000..cf8e021 --- /dev/null +++ b/bin/tests/data/deprecated_to_path.nix @@ -0,0 +1,6 @@ +[ + (builtins.toPath x) + (toPath x) + (toPath "/abc/def") + (builtins.toPath "/some/path") +] diff --git a/bin/tests/main.rs b/bin/tests/main.rs index 2c4b521..bec64d2 100644 --- a/bin/tests/main.rs +++ b/bin/tests/main.rs @@ -62,5 +62,6 @@ test_lint! { deprecated_is_null, empty_inherit, faster_groupby => session_info!("2.5"), - faster_zipattrswith => session_info!("2.6") + faster_zipattrswith => session_info!("2.6"), + deprecated_to_path => session_info!("2.4") } diff --git a/bin/tests/snapshots/main__deprecated_to_path.snap b/bin/tests/snapshots/main__deprecated_to_path.snap new file mode 100644 index 0000000..08e0dbe --- /dev/null +++ b/bin/tests/snapshots/main__deprecated_to_path.snap @@ -0,0 +1,34 @@ +--- +source: bin/tests/main.rs +expression: "&out" + +--- +[W17] Warning: Found usage of deprecated builtin toPath + ╭─[data/deprecated_to_path.nix:2:4] + │ + 2 │ (builtins.toPath x) + · ────────┬──────── + · ╰────────── builtins.toPath is deprecated, see :doc builtins.toPath within the REPL for more +───╯ +[W17] Warning: Found usage of deprecated builtin toPath + ╭─[data/deprecated_to_path.nix:3:4] + │ + 3 │ (toPath x) + · ────┬─── + · ╰───── toPath is deprecated, see :doc builtins.toPath within the REPL for more +───╯ +[W17] Warning: Found usage of deprecated builtin toPath + ╭─[data/deprecated_to_path.nix:4:4] + │ + 4 │ (toPath "/abc/def") + · ────────┬──────── + · ╰────────── toPath is deprecated, see :doc builtins.toPath within the REPL for more +───╯ +[W17] Warning: Found usage of deprecated builtin toPath + ╭─[data/deprecated_to_path.nix:5:4] + │ + 5 │ (builtins.toPath "/some/path") + · ──────────────┬───────────── + · ╰─────────────── builtins.toPath is deprecated, see :doc builtins.toPath within the REPL for more +───╯ + -- cgit v1.2.3