From a9b3ea3c5e1fc831012fd1a8d8500396101a0ce6 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 17 Mar 2023 17:34:22 +0100 Subject: [PATCH] Make formatting manual for now Objections were raised about automatic installation of hooks. --- doc/manual/src/contributing/hacking.md | 23 +++++++++++++++++++---- maintainers/flake-module.nix | 3 +++ maintainers/local.mk | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/doc/manual/src/contributing/hacking.md b/doc/manual/src/contributing/hacking.md index 93a48740679..dc1eed13cc0 100644 --- a/doc/manual/src/contributing/hacking.md +++ b/doc/manual/src/contributing/hacking.md @@ -192,15 +192,30 @@ Configure your editor to use the `clangd` from the shell, either by running it i > Some other editors (e.g. Emacs, Vim) need a plugin to support LSP servers in general (e.g. [lsp-mode](https://github.com/emacs-lsp/lsp-mode) for Emacs and [vim-lsp](https://github.com/prabirshrestha/vim-lsp) for vim). > Editor-specific setup is typically opinionated, so we will not cover it here in more detail. -## Pre-commit and formatting +## Formatting and pre-commit + +You may run the formatters as a one-off using: + +```console +make format +``` + + + +The hook configuration is only regenerated when you start a new development shell. ## Running tests diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index a6357cfbcb2..cb12bd757ae 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -9,6 +9,9 @@ # https://flake.parts/options/pre-commit-hooks-nix.html#options pre-commit.settings = { + + default_stages = [ "manual" ]; + hooks = { clang-format.enable = true; nixpkgs-fmt.enable = true; diff --git a/maintainers/local.mk b/maintainers/local.mk index f1e3a36f835..b087d0135b9 100644 --- a/maintainers/local.mk +++ b/maintainers/local.mk @@ -7,4 +7,4 @@ format: echo "make format: pre-commit not found. Please use \`nix develop\`."; \ exit 1; \ fi; \ - pre-commit run --all-files + pre-commit run --all-files --hook-stage manual