Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,8 @@ jobs:
with:
node-version: "20"
- name: Prettier check
run: |
# if you encounter error, rerun the command below and commit the changes
#
# ignore subproject CHANGELOG.md because they are machine generated
npx [email protected] --write \
'{datafusion,datafusion-cli,datafusion-examples,dev,docs}/**/*.md' \
'!datafusion/CHANGELOG.md' \
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.

👍

run: ci/scripts/doc_prettier_check.sh

typos:
name: Spell Check with Typos
Expand All @@ -72,4 +64,4 @@ jobs:
- name: Install typos-cli
run: cargo install typos-cli --locked --version 1.37.0
- name: Run typos check
run: ci/scripts/typos_check.sh
run: ci/scripts/typos_check.sh
57 changes: 57 additions & 0 deletions ci/scripts/doc_prettier_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/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]}")"

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

# Ignore subproject CHANGELOG.md because it is machine generated
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
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
1 change: 1 addition & 0 deletions dev/rust_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ ci/scripts/rust_toml_fmt.sh
ci/scripts/rust_docs.sh
ci/scripts/license_header.sh
ci/scripts/typos_check.sh
ci/scripts/doc_prettier_check.sh