Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(back): #1332 add check flag to nixfmt #1340

Merged
merged 1 commit into from
Jun 24, 2024
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
2 changes: 1 addition & 1 deletion docs/src/api/builtins/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Example:
## formatNix

Ensure that Nix code is formatted
according to [Alejandra](https://github.com/kamadorueda/alejandra).
according to [nixfmt](https://github.com/NixOS/nixfmt).

Types:

Expand Down
6 changes: 5 additions & 1 deletion src/args/format-nix/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

function main {
source __argTargets__/template local targets
local args=()

info Formatting Nix code \
&& if running_in_ci_cd_provider; then
args+=(--check)
fi \
&& for target in "${targets[@]}"; do
info Formatting "${target}" \
&& if ! nixfmt "${target}"; then
&& if ! nixfmt "${args[@]}" "${target}"; then
info Source code was formated, the job will fail \
&& error Failing as promised...
fi \
Expand Down
Loading