about summary refs log tree commit diff
path: root/pkgs/development/tools/ruff/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/ruff/default.nix')
-rw-r--r--pkgs/development/tools/ruff/default.nix58
1 files changed, 27 insertions, 31 deletions
diff --git a/pkgs/development/tools/ruff/default.nix b/pkgs/development/tools/ruff/default.nix
index a58eadf632ff4..499c3c8819c29 100644
--- a/pkgs/development/tools/ruff/default.nix
+++ b/pkgs/development/tools/ruff/default.nix
@@ -6,26 +6,27 @@
 , darwin
 , rust-jemalloc-sys
 , ruff-lsp
+, nix-update-script
 , testers
 , ruff
 }:
 
 rustPlatform.buildRustPackage rec {
   pname = "ruff";
-  version = "0.4.10";
+  version = "0.5.5";
 
   src = fetchFromGitHub {
     owner = "astral-sh";
     repo = "ruff";
-    rev = "refs/tags/v${version}";
-    hash = "sha256-FRBuvXtnbxRWoI0f8SM0U0Z5TRyX5Tbgq3d34Oh2bG4=";
+    rev = "refs/tags/${version}";
+    hash = "sha256-dqfK6YdAV4cdUYB8bPE9I5FduBJ90RxUA7TMvcVq6Zw=";
   };
 
   cargoLock = {
     lockFile = ./Cargo.lock;
     outputHashes = {
       "lsp-types-0.95.1" = "sha256-8Oh299exWXVi6A39pALOISNfp8XBya8z+KT/Z7suRxQ=";
-      "salsa-2022-0.1.0" = "sha256-mt+X1hO+5ZrCAgy6N4aArnixJ9GjY/KwM0uIMUSrDsg=";
+      "salsa-0.18.0" = "sha256-gcaAsrrJXrWOIHUnfBwwuTBG1Mb+lUEmIxSGIVLhXaM=";
     };
   };
 
@@ -39,32 +40,7 @@ rustPlatform.buildRustPackage rec {
     darwin.apple_sdk.frameworks.CoreServices
   ];
 
-  # tests expect no colors
-  preCheck = ''
-    export NO_COLOR=1
-  '';
-
-  # Failing for an unclear reason.
-  # According to the maintainers, those tests are from an experimental crate that isn't actually
-  # used by ruff currently and can thus be safely skipped.
-  checkFlags = [
-    "--skip=semantic::tests::expression_scope"
-    "--skip=semantic::tests::reachability_trivial"
-    "--skip=semantic::types::infer::tests::follow_import_to_class"
-    "--skip=semantic::types::infer::tests::if_elif"
-    "--skip=semantic::types::infer::tests::if_elif_else"
-    "--skip=semantic::types::infer::tests::ifexpr_walrus"
-    "--skip=semantic::types::infer::tests::ifexpr_walrus_2"
-    "--skip=semantic::types::infer::tests::join_paths"
-    "--skip=semantic::types::infer::tests::literal_int_arithmetic"
-    "--skip=semantic::types::infer::tests::maybe_unbound"
-    "--skip=semantic::types::infer::tests::narrow_none"
-    "--skip=semantic::types::infer::tests::resolve_base_class_by_name"
-    "--skip=semantic::types::infer::tests::resolve_module_member"
-    "--skip=semantic::types::infer::tests::resolve_visible_def"
-  ];
-
-  postInstall = ''
+  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
     installShellCompletion --cmd ruff \
       --bash <($out/bin/ruff generate-shell-completion bash) \
       --fish <($out/bin/ruff generate-shell-completion fish) \
@@ -73,13 +49,33 @@ rustPlatform.buildRustPackage rec {
 
   passthru.tests = {
     inherit ruff-lsp;
+    updateScript = nix-update-script { };
     version = testers.testVersion { package = ruff; };
   };
 
+  # Failing on darwin for an unclear reason.
+  # According to the maintainers, those tests are from an experimental crate that isn't actually
+  # used by ruff currently and can thus be safely skipped.
+  checkFlags = lib.optionals stdenv.isDarwin [
+    "--skip=changed_file"
+    "--skip=changed_metadata"
+    "--skip=deleted_file"
+    "--skip=directory_deleted"
+    "--skip=directory_moved_to_trash"
+    "--skip=directory_moved_to_workspace"
+    "--skip=directory_renamed"
+    "--skip=move_file_to_trash"
+    "--skip=move_file_to_workspace"
+    "--skip=new_file"
+    "--skip=new_ignored_file"
+    "--skip=rename_file"
+    "--skip=search_path"
+  ];
+
   meta = {
     description = "Extremely fast Python linter";
     homepage = "https://github.com/astral-sh/ruff";
-    changelog = "https://github.com/astral-sh/ruff/releases/tag/v${version}";
+    changelog = "https://github.com/astral-sh/ruff/releases/tag/${version}";
     license = lib.licenses.mit;
     mainProgram = "ruff";
     maintainers = with lib.maintainers; [