Repository navigation
dev: Add CI doc prettier check to local rust_lint.sh
#19254
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
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
review: update the script with --write option
- Loading branch information
commit 573fd6427179ad984a976f0a25139764a5abfdbb
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,26 +18,40 @@ | |
| # under the License. | ||
|
|
||
| SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" | ||
| echo "$SCRIPT_PATH: Checking document format with prettier" | ||
|
|
||
| MODE="--check" | ||
| ACTION="Checking" | ||
| if [ $# -gt 0 ]; then | ||
| if [ "$1" = "--write" ]; then | ||
| MODE="--write" | ||
| ACTION="Formatting" | ||
| else | ||
| echo "Usage: $0 [--write]" >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "$SCRIPT_PATH: $ACTION documents with prettier" | ||
|
|
||
| # Ensure `npx` is available | ||
| if ! command -v npx >/dev/null 2>&1; then | ||
| echo "npx is required to run the prettier check. Install Node.js (e.g., brew install node) and re-run." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # if you encounter error, change '--check' to '--write' in the below command, and | ||
| # commit the change. | ||
| # | ||
| # Ignore subproject CHANGELOG.md because it is machine generated | ||
| npx [email protected] --check \ | ||
| npx [email protected] $MODE \ | ||
| '{datafusion,datafusion-cli,datafusion-examples,dev,docs}/**/*.md' \ | ||
| '!datafusion/CHANGELOG.md' \ | ||
| README.md \ | ||
| CONTRIBUTING.md | ||
| status=$? | ||
|
|
||
| if [ $status -ne 0 ]; then | ||
| echo "Prettier check failed. To fix, rerun `prettier` with --write (change --check to --write in the script), commit the formatted files, and re-run the check." >&2 | ||
| if [ "$MODE" = "--check" ]; then | ||
| echo "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." >&2 | ||
| else | ||
| echo "Prettier format failed. Files may have been modified; commit any changes and re-run." >&2 | ||
| fi | ||
| exit $status | ||
| fi | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use
All the time now in my dev workflow 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have auto fixes for other lint violations now
I haven't used it extensively yet, so there may still be some bugs and potential improvements.