Hi,

> > This is how wrap-and-sort -ast works. Formatting is in
> > https://salsa.debian.org/debian/debcraft/-/blob/main/src/container/improve.d/formatting.sh
> >
> > I wish wrap-and-sort had good defaults and that we all could simply
> > run 'wrap-and-sort' without any options. However this is not the case,
> > and I think the "golden standard" fo rmost people is to run it with
> > -ast (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895570).
> > Having tools that automatically format and fix packages is
> > unreasonably hard to implement if a lot of people have personal
> > preferences on the details.
>
> Hmm, people do know about `debputy reformat` and X-Style: black, right?

Copying the script above here verbatim for reference on what it does in detail:

CMD=(debputy reformat --style black)
echo "++ ${CMD[*]}"

if "${CMD[@]}"
then
  true
else
  EXIT_CODE=$?
  log_warn "Command exited with code $EXIT_CODE."
  # E.g. exit code 2 is emitted if files were formatted and that is not an error
fi

# Apply `wrap-and-sort -vast` that modifies more files than debputy, and helps
# ensure all changes are easy to track in git
log_command wrap-and-sort -ast

# Commit formatting changes if any files were modified by the tools above
if ! git diff --quiet
then
  git commit -a -F - <<'EOF'
Apply consistent formatting to packaging files

Run `debputy reformat --style black` and `wrap-and-sort -vast` to enforce
uniform deb822 formatting with one item per line. This makes future
changes to dependencies and other lists easier to track in git diffs.

No functional changes.
EOF
fi

Reply via email to