2010YOUY01 commented on code in PR #19254: URL: https://github.com/apache/datafusion/pull/19254#discussion_r2609827780
########## ci/scripts/doc_prettier_check.sh: ########## @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" +echo "$SCRIPT_PATH: Checking document format 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 Review Comment: Good point! Updated in [573fd64](https://github.com/apache/datafusion/pull/19254/commits/573fd6427179ad984a976f0a25139764a5abfdbb) 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 https://github.com/apache/datafusion/issues/19227 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
