Skip to content

Conversation

@2010YOUY01
Copy link
Contributor

Which issue does this PR close?

A small step towards #19227

Rationale for this change

What changes are included in this PR?

  • Move doc prettier check command to a local script
  • Add this script to the lint-check runner dev/rust_lint.sh to make local development easier
    (Technically it's neither rust nor lint, but keeping all non functional tests here seem to be the most convenient.)

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added documentation Improvements or additions to documentation development-process Related to development process of DataFusion labels Dec 10, 2025
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| elapsed_compute | CPU time the operator actively spends processing work. |
| output_rows | Total number of rows the operator produces. |
| output_rows | Total number of rows the operator produces. |
Copy link
Contributor Author

@2010YOUY01 2010YOUY01 Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Injecting this prettier violation to test CI works as before.

It failed in https://github.com/apache/datafusion/actions/runs/20094525462/job/57649510711?pr=19254

@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Dec 10, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @2010YOUY01

README.md \
CONTRIBUTING.md
git diff --exit-code
# if you encounter error, see instructions inside the script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

exit 1
fi

# if you encounter error, change '--check' to '--write' in the below command, and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this out locally and it worked great for me:

$ ./ci/scripts/doc_prettier_check.sh
/Users/andrewlamb/Software/datafusion/ci/scripts/doc_prettier_check.sh: Checking document format with prettier
Checking formatting...
[warn] docs/source/library-user-guide/upgrading.md
[warn] Code style issues found in the above file. Forgot to run Prettier?
./ci/scripts/doc_prettier_check.sh: line 41: prettier: command not found
Prettier check failed. To fix, rerun  with --write (change --check to --write in the script), commit the formatted files, and re-run the check.

I think it would be even nicer / better if it could also make the changes as well (so people don't have to do a second step to update the prettier docs)

For example, if the check fails, maybe it could automatically re-run prettier with --write

Or maybe the script could accept a --write command to get it to write?

$ ./ci/scripts/doc_prettier_check.sh --write

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Updated in 573fd64

Now for check failures, the error message look like

yongting@Yongtings-MacBook-Pro-2 ~/C/datafusion (doc-prettier-script *=) [1]> ./ci/scripts/doc_prettier_check.sh
/Users/yongting/Code/datafusion/ci/scripts/doc_prettier_check.sh: Checking documents with prettier
Checking formatting...
[warn] docs/source/user-guide/metrics.md
[warn] Code style issues found in the above file. Forgot to run Prettier?
Prettier check failed. Re-run with --write (e.g., ./ci/scripts/doc_prettier_check.sh --write) to format files, commit the changes, and re-run the check.

And we can use --write option to fix.

I think there are several other potential auto fixes we can do, they can all be wrapped inside the lint script with --write option like

# best-effort auto fixes for all available places
./dev/rust_lint.sh --write

This idea is tracked in #19227

@alamb
Copy link
Contributor

alamb commented Dec 11, 2025

nice -- thank you @2010YOUY01 !

@alamb
Copy link
Contributor

alamb commented Dec 11, 2025

I ran it one more time manually

(venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion$ ci/scripts/doc_prettier_check.sh
/Users/andrewlamb/Software/datafusion/ci/scripts/doc_prettier_check.sh: Checking documents with prettier
Checking formatting...
[warn] docs/source/library-user-guide/upgrading.md
[warn] Code style issues found in the above file. Forgot to run Prettier?
Prettier check failed. Re-run with --write (e.g., ./ci/scripts/doc_prettier_check.sh --write) to format files, commit the changes, and re-run the check.
(venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion$ ci/scripts/doc_prettier_check.sh --write
/Users/andrewlamb/Software/datafusion/ci/scripts/doc_prettier_check.sh: Formatting documents with prettier
...
(venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion$ ci/scripts/doc_prettier_check.sh
/Users/andrewlamb/Software/datafusion/ci/scripts/doc_prettier_check.sh: Checking documents with prettier
Checking formatting...
All matched files use Prettier code style!
(venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion$

@alamb alamb added this pull request to the merge queue Dec 11, 2025
@alamb
Copy link
Contributor

alamb commented Dec 11, 2025

Love it -- thank you @2010YOUY01

Merged via the queue into apache:main with commit 33b3f02 Dec 11, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Related to development process of DataFusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants