Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ We format all our code using the coding conventions in the
tool. This tool uses uncrustify under the hood. To format the python test files
we use [black](https://github.com/psf/black).

If you have Docker available, the simplest way to check or fix formatting
locally, without installing anything, is:

```bash
make docker-check # check only -- matches CI's citus_indent --check exactly
make docker-indent # auto-fix
```

Otherwise, install citus_indent locally:

```bash
# Uncrustify changes the way it formats code every release a bit. To make sure
# everyone formats consistently we use version 0.68.1:
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,20 @@ test ci-test run-test run-test-prebuilt:
# To check or auto-fix locally without installing citus_indent:
# make docker-check # check only
# make docker-indent # auto-fix
#
# citus_indent calls `git ls-files` to find the files it should look at, so
# the container needs a working .git. In a plain checkout that's already
# true (.git lives under $(CURDIR), which is mounted at /workdir). In a git
# worktree, $(CURDIR)/.git is only a pointer file ("gitdir: <main-repo>/.git/
# worktrees/<name>") to a path outside $(CURDIR) -- GIT_COMMON_DIR resolves
# that pointer on the host and the extra -v mounts it into the container at
# the identical absolute path, so it still resolves there too. This is a
# harmless no-op for a plain checkout (it just mounts $(CURDIR)/.git over
# itself).
GIT_COMMON_DIR := $(shell cd "$(CURDIR)" && cd "$$(git rev-parse --git-common-dir 2>/dev/null)" 2>/dev/null && pwd)
CITUS_INDENT_DOCKER = docker run --rm \
-v "$(CURDIR):/workdir" \
$(if $(GIT_COMMON_DIR),-v "$(GIT_COMMON_DIR):$(GIT_COMMON_DIR)") \
-w /workdir \
citus/stylechecker:no-py \
citus_indent
Expand Down