From 9d4c03db015dacac22fb4b40c76608aa4e4653f1 Mon Sep 17 00:00:00 2001 From: Hannes Date: Wed, 5 Mar 2025 19:09:00 +0800 Subject: [PATCH] =?UTF-8?q?sqruff:=200.20.2=20=E2=86=92=200.25.28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sq/sqruff/disable-templaters-test.diff | 15 +++++++++++ .../sq/sqruff/disable-ui_with_dbt-test.diff | 15 +++++++++++ .../sq/sqruff/disable-ui_with_jinja-test.diff | 15 +++++++++++ .../sqruff/disable-ui_with_python-test.diff | 15 +++++++++++ pkgs/by-name/sq/sqruff/package.nix | 27 +++++++++++++++---- 5 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 pkgs/by-name/sq/sqruff/disable-templaters-test.diff create mode 100644 pkgs/by-name/sq/sqruff/disable-ui_with_dbt-test.diff create mode 100644 pkgs/by-name/sq/sqruff/disable-ui_with_jinja-test.diff create mode 100644 pkgs/by-name/sq/sqruff/disable-ui_with_python-test.diff diff --git a/pkgs/by-name/sq/sqruff/disable-templaters-test.diff b/pkgs/by-name/sq/sqruff/disable-templaters-test.diff new file mode 100644 index 000000000000..1da2192fedf1 --- /dev/null +++ b/pkgs/by-name/sq/sqruff/disable-templaters-test.diff @@ -0,0 +1,15 @@ +diff --git a/crates/lib/tests/templaters.rs b/crates/lib/tests/templaters.rs +index f92604e1..84885f9f 100644 +--- a/crates/lib/tests/templaters.rs ++++ b/crates/lib/tests/templaters.rs +@@ -32,6 +32,10 @@ impl Args { + } + } + ++#[cfg(not(feature = "python"))] ++fn main() {} ++ ++#[cfg(feature = "python")] + // FIXME: Simplify FluffConfig handling. It's quite chaotic right now. + fn main() { + let mut args = Args::default(); diff --git a/pkgs/by-name/sq/sqruff/disable-ui_with_dbt-test.diff b/pkgs/by-name/sq/sqruff/disable-ui_with_dbt-test.diff new file mode 100644 index 000000000000..ee6e3250adb8 --- /dev/null +++ b/pkgs/by-name/sq/sqruff/disable-ui_with_dbt-test.diff @@ -0,0 +1,15 @@ +diff --git a/crates/cli/tests/ui_with_dbt.rs b/crates/cli/tests/ui_with_dbt.rs +index d71a26c1..4d4ffe4f 100644 +--- a/crates/cli/tests/ui_with_dbt.rs ++++ b/crates/cli/tests/ui_with_dbt.rs +@@ -3,6 +3,10 @@ use std::path::PathBuf; + use assert_cmd::Command; + use expect_test::expect_file; + ++#[cfg(not(feature = "python"))] ++fn main() {} ++ ++#[cfg(feature = "python")] + fn main() { + let sample_dbt_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() diff --git a/pkgs/by-name/sq/sqruff/disable-ui_with_jinja-test.diff b/pkgs/by-name/sq/sqruff/disable-ui_with_jinja-test.diff new file mode 100644 index 000000000000..0c202dadc247 --- /dev/null +++ b/pkgs/by-name/sq/sqruff/disable-ui_with_jinja-test.diff @@ -0,0 +1,15 @@ +diff --git a/crates/cli/tests/ui_with_jinja.rs b/crates/cli/tests/ui_with_jinja.rs +index 7c39f8a1..e4c96d41 100644 +--- a/crates/cli/tests/ui_with_jinja.rs ++++ b/crates/cli/tests/ui_with_jinja.rs +@@ -4,6 +4,10 @@ use std::path::PathBuf; + use assert_cmd::Command; + use expect_test::expect_file; + ++#[cfg(not(feature = "python"))] ++fn main() {} ++ ++#[cfg(feature = "python")] + fn main() { + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("tests/jinja"); diff --git a/pkgs/by-name/sq/sqruff/disable-ui_with_python-test.diff b/pkgs/by-name/sq/sqruff/disable-ui_with_python-test.diff new file mode 100644 index 000000000000..bcf1b957fca5 --- /dev/null +++ b/pkgs/by-name/sq/sqruff/disable-ui_with_python-test.diff @@ -0,0 +1,15 @@ +diff --git a/crates/cli/tests/ui_with_python.rs b/crates/cli/tests/ui_with_python.rs +index 826f399c..0fa5ae33 100644 +--- a/crates/cli/tests/ui_with_python.rs ++++ b/crates/cli/tests/ui_with_python.rs +@@ -4,6 +4,10 @@ use std::path::PathBuf; + use assert_cmd::Command; + use expect_test::expect_file; + ++#[cfg(not(feature = "python"))] ++fn main() {} ++ ++#[cfg(feature = "python")] + fn main() { + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("tests/python"); diff --git a/pkgs/by-name/sq/sqruff/package.nix b/pkgs/by-name/sq/sqruff/package.nix index f497f538e290..269d76be215c 100644 --- a/pkgs/by-name/sq/sqruff/package.nix +++ b/pkgs/by-name/sq/sqruff/package.nix @@ -9,25 +9,42 @@ }: rustPlatform.buildRustPackage rec { pname = "sqruff"; - version = "0.20.2"; + version = "0.25.28"; src = fetchFromGitHub { owner = "quarylabs"; repo = "sqruff"; tag = "v${version}"; - hash = "sha256-Vlre3D1ydDqFdysf5no2rW2V2U/BimhCeV1vWZ2JPSM="; + hash = "sha256-Xea6jXQos5gyF1FeGF7B5YaQszqfsKhGw1k8j0m7J6c="; }; useFetchCargoVendor = true; - cargoHash = "sha256-sFKq7CxQ7yoPqDQOR9Nr111RCiSA6bK50QvhHkaU5Go="; + cargoHash = "sha256-agB//UDTsEje9pgig07dUy8/Fr+zx7/MC3AdLjqoKJY="; buildInputs = [ rust-jemalloc-sys ]; - # Patch the tests to find the binary + # Disable the `python` feature which doesn't work on Nix yet + buildNoDefaultFeatures = true; + # The jinja and dbt template engines require the `python` feature which we disabled, so we disable these tests + patches = [ + ./disable-templaters-test.diff + ./disable-ui_with_dbt-test.diff + ./disable-ui_with_jinja-test.diff + ./disable-ui_with_python-test.diff + ]; + + # Patch the tests to find the sqruff binary postPatch = '' - substituteInPlace crates/cli/tests/ui.rs \ + substituteInPlace \ + crates/cli/tests/config_not_found.rs \ + crates/cli/tests/configure_rule.rs \ + crates/cli/tests/fix_parse_errors.rs \ + crates/cli/tests/fix_return_code.rs \ + crates/cli/tests/ui_github.rs \ + crates/cli/tests/ui_json.rs \ + crates/cli/tests/ui.rs \ --replace-fail \ 'sqruff_path.push(format!("../../target/{}/sqruff", profile));' \ 'sqruff_path.push(format!("../../target/${stdenv.hostPlatform.rust.cargoShortTarget}/{}/sqruff", profile));'