Parcourir la source

chore: remove precommit hooks (#1475)

tsk il y a 4 semaines
Parent
commit
02b1b04ffa
3 fichiers modifiés avec 16 ajouts et 121 suppressions
  1. 0 74
      flake.lock
  2. 0 46
      flake.nix
  3. 16 1
      justfile

+ 0 - 74
flake.lock

@@ -36,22 +36,6 @@
         "type": "github"
       }
     },
-    "flake-compat": {
-      "flake": false,
-      "locked": {
-        "lastModified": 1761588595,
-        "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
-        "owner": "edolstra",
-        "repo": "flake-compat",
-        "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
-        "type": "github"
-      },
-      "original": {
-        "owner": "edolstra",
-        "repo": "flake-compat",
-        "type": "github"
-      }
-    },
     "flake-utils": {
       "inputs": {
         "systems": "systems"
@@ -70,27 +54,6 @@
         "type": "github"
       }
     },
-    "gitignore": {
-      "inputs": {
-        "nixpkgs": [
-          "pre-commit-hooks",
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "lastModified": 1709087332,
-        "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
-        "owner": "hercules-ci",
-        "repo": "gitignore.nix",
-        "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
-        "type": "github"
-      },
-      "original": {
-        "owner": "hercules-ci",
-        "repo": "gitignore.nix",
-        "type": "github"
-      }
-    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1765762245,
@@ -107,49 +70,12 @@
         "type": "github"
       }
     },
-    "nixpkgs_2": {
-      "locked": {
-        "lastModified": 1764947035,
-        "narHash": "sha256-EYHSjVM4Ox4lvCXUMiKKs2vETUSL5mx+J2FfutM7T9w=",
-        "owner": "NixOS",
-        "repo": "nixpkgs",
-        "rev": "a672be65651c80d3f592a89b3945466584a22069",
-        "type": "github"
-      },
-      "original": {
-        "owner": "NixOS",
-        "ref": "nixpkgs-unstable",
-        "repo": "nixpkgs",
-        "type": "github"
-      }
-    },
-    "pre-commit-hooks": {
-      "inputs": {
-        "flake-compat": "flake-compat",
-        "gitignore": "gitignore",
-        "nixpkgs": "nixpkgs_2"
-      },
-      "locked": {
-        "lastModified": 1765464257,
-        "narHash": "sha256-dixPWKiHzh80PtD0aLuxYNQ0xP+843dfXG/yM3OzaYQ=",
-        "owner": "cachix",
-        "repo": "pre-commit-hooks.nix",
-        "rev": "09e45f2598e1a8499c3594fe11ec2943f34fe509",
-        "type": "github"
-      },
-      "original": {
-        "owner": "cachix",
-        "repo": "pre-commit-hooks.nix",
-        "type": "github"
-      }
-    },
     "root": {
       "inputs": {
         "crane": "crane",
         "fenix": "fenix",
         "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs",
-        "pre-commit-hooks": "pre-commit-hooks",
         "rust-overlay": "rust-overlay"
       }
     },

+ 0 - 46
flake.nix

@@ -22,8 +22,6 @@
     crane = {
       url = "github:ipetkov/crane";
     };
-
-    pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
   };
 
   outputs =
@@ -31,7 +29,6 @@
     , nixpkgs
     , rust-overlay
     , flake-utils
-    , pre-commit-hooks
     , crane
     , ...
     }@inputs:
@@ -532,48 +529,10 @@
 
             # FFI Python tests
             ffi-tests = ffiTests;
-
-            # Pre-commit checks
-            pre-commit-check =
-              let
-                # this is a hack based on https://github.com/cachix/pre-commit-hooks.nix/issues/126
-                # we want to use our own rust stuff from oxalica's overlay
-                _rust = pkgs.rust-bin.stable.latest.default;
-                rust = pkgs.buildEnv {
-                  name = _rust.name;
-                  inherit (_rust) meta;
-                  buildInputs = [ pkgs.makeWrapper ];
-                  paths = [ _rust ];
-                  pathsToLink = [
-                    "/"
-                    "/bin"
-                  ];
-                  postBuild = ''
-                    for i in $out/bin/*; do
-                      wrapProgram "$i" --prefix PATH : "$out/bin"
-                    done
-                  '';
-                };
-              in
-              pre-commit-hooks.lib.${system}.run {
-                src = ./.;
-                hooks = {
-                  rustfmt = {
-                    enable = true;
-                    entry = lib.mkForce "${rust}/bin/cargo-fmt fmt --all -- --config format_code_in_doc_comments=true --check --color always";
-                  };
-                  nixpkgs-fmt.enable = true;
-                  typos.enable = true;
-                  commitizen.enable = true; # conventional commits
-                };
-              };
           };
 
         devShells =
           let
-            # pre-commit-checks
-            _shellHook = (self.checks.${system}.pre-commit-check.shellHook or "");
-
             # devShells
             msrv = pkgs.mkShell (
               {
@@ -581,7 +540,6 @@
                   cargo update
                   cargo update home --precise 0.5.11
                   cargo update typed-index-collections --precise 3.3.0
-              ${_shellHook}
               ";
                 buildInputs = buildInputs ++ [ msrv_toolchain ];
                 inherit nativeBuildInputs;
@@ -592,7 +550,6 @@
             stable = pkgs.mkShell (
               {
                 shellHook = ''
-                  ${_shellHook}
                   # Needed for github ci
                   export LD_LIBRARY_PATH=${
                     pkgs.lib.makeLibraryPath [
@@ -628,7 +585,6 @@
             nightly = pkgs.mkShell (
               {
                 shellHook = ''
-                  ${_shellHook}
                   # Needed for github ci
                   export LD_LIBRARY_PATH=${
                     pkgs.lib.makeLibraryPath [
@@ -664,7 +620,6 @@
             integration = pkgs.mkShell (
               {
                 shellHook = ''
-                  ${_shellHook}
                   # Ensure Docker is available
                   if ! command -v docker &> /dev/null; then
                     echo "Docker is not installed or not in PATH"
@@ -688,7 +643,6 @@
             ffi = pkgs.mkShell (
               {
                 shellHook = ''
-                  ${_shellHook}
                   echo "FFI development shell"
                   echo "  just ffi-test        - Run Python FFI tests"
                   echo "  just ffi-dev-python  - Launch Python REPL with CDK FFI"

+ 16 - 1
justfile

@@ -254,7 +254,7 @@ clippy *ARGS="--workspace --all-targets":
 clippy-fix *ARGS="--workspace --all-targets":
   cargo clippy {{ARGS}} --fix
 
-typos: 
+typos:
   typos
 
 # fix all typos
@@ -262,6 +262,21 @@ typos:
 typos-fix:
   just typos -w
 
+# run all linting checks (format check, typos, nix format)
+lint:
+  #!/usr/bin/env bash
+  set -euo pipefail
+  if [ ! -f Cargo.toml ]; then
+    cd {{invocation_directory()}}
+  fi
+  echo "Checking Rust formatting..."
+  cargo fmt --all -- --check
+  echo "Checking Nix formatting..."
+  nixpkgs-fmt --check $(echo **.nix)
+  echo "Checking for typos..."
+  typos
+  echo "All checks passed!"
+
 # Goose AI Recipe Commands
 
 # Update changelog from staged changes using Goose AI