sqruff: 0.20.2 → 0.25.28 (#387266)

This commit is contained in:
Peder Bergebakken Sundt 2025-06-04 04:39:06 +02:00 committed by GitHub
commit 1c93270d74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 82 additions and 5 deletions

View File

@ -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();

View File

@ -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()

View File

@ -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");

View File

@ -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");

View File

@ -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));'