Skip to content

Commit

Permalink
Make formatting manual for now
Browse files Browse the repository at this point in the history
Objections were raised about automatic installation of hooks.
  • Loading branch information
roberth committed Mar 17, 2023
1 parent 91d1bbd commit a9b3ea3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
23 changes: 19 additions & 4 deletions doc/manual/src/contributing/hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

<!-- TBD, opt-in, blocked on https://github.com/cachix/pre-commit-hooks.nix/pull/261
If you'd like to run the formatters before every commit, install the hooks:
```
nix-pre-commit-hooks-install
```
`nix develop` installs Nix-[integrated](https://github.com/cachix/pre-commit-hooks.nix) [pre-commit](https://pre-commit.com) hooks.
The formatters will run when you commit.
Pay attention to the console output. If it fails, run `git add --patch` to
When the hook fails, because files were updated, run `git add --patch` to
approve the suggestions _and commit again_.
The hook configuration is only regenerated when you start a new dev shell.
-->

The hook configuration is only regenerated when you start a new development shell.

## Running tests

Expand Down
3 changes: 3 additions & 0 deletions maintainers/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion maintainers/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a9b3ea3

Please sign in to comment.