Skip to content

Commit

Permalink
Merge pull request #1340 from rohaquinlop/issue-1332
Browse files Browse the repository at this point in the history
feat(back): #1332 add check flag to nixfmt
  • Loading branch information
dsalaza4 authored Jun 24, 2024
2 parents dcb3432 + f026919 commit dd54c58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit dd54c58

Please sign in to comment.