Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions scripts/autogen
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def finalize_format_batch(batch):
if p.returncode != 0:
print(p.stderr)
print(
f"Failed to auto-format autogenerated code (clang-format return code {p.returncode}). Are you running in a nix shell? See BUILDING.md."
f"Failed to auto-format autogenerated code (clang-format return code {p.returncode}). Are you running in a nix shell? See CONTRIBUTING.md."
)
exit(1)

Expand Down Expand Up @@ -291,7 +291,7 @@ def format_content(content):
if p.returncode != 0:
print(p.stderr)
print(
f"Failed to auto-format autogenerated code (clang-format return code {p.returncode}). Are you running in a nix shell? See BUILDING.md."
f"Failed to auto-format autogenerated code (clang-format return code {p.returncode}). Are you running in a nix shell? See CONTRIBUTING.md."
)
exit(1)
return p.stdout
Expand Down
8 changes: 4 additions & 4 deletions scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ error()

info "Formatting nix files"
if ! command -v nixpkgs-fmt 2>&1 >/dev/null; then
error "nixpkgs-fmt not found. Are you running in a nix shell? See BUILDING.md."
error "nixpkgs-fmt not found. Are you running in a nix shell? See CONTRIBUTING.md."
exit 1
fi

nixpkgs-fmt "$ROOT"

info "Formatting shell scripts"
if ! command -v shfmt 2>&1 >/dev/null; then
error "shfmt not found. Are you running in a nix shell? See BUILDING.md."
error "shfmt not found. Are you running in a nix shell? See CONTRIBUTING.md."
exit 1
fi
shfmt -s -w -l -i 2 -ci -fn $(shfmt -f $(git grep -l '' :/))

info "Formatting python scripts"
if ! command -v black 2>&1 >/dev/null; then
error "black not found. Are you running in a nix shell? See BUILDING.md."
error "black not found. Are you running in a nix shell? See CONTRIBUTING.md."
exit 1
fi
black --include "(scripts/tests|scripts/simpasm|scripts/cfify|scripts/autogen|scripts/check-namespace|\.py$)" "$ROOT"

info "Formatting c files"
if ! command -v clang-format 2>&1 >/dev/null; then
error "clang-format not found. Are you running in a nix shell? See BUILDING.md."
error "clang-format not found. Are you running in a nix shell? See CONTRIBUTING.md."
exit 1
fi

Expand Down