This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-js.git


The following commit(s) were added to refs/heads/main by this push:
     new 16e2169  chore: Add shfmt and shellcheck linters (#158)
16e2169 is described below

commit 16e21694cb66eafda295d3a07c1685bdd7bd65d6
Author: Sutou Kouhei <[email protected]>
AuthorDate: Tue Jun 17 10:58:24 2025 +0900

    chore: Add shfmt and shellcheck linters (#158)
    
    ## What's Changed
    
    They are shell linters. shfmt uses indent configurations in
    `.editorconfig`.
    
    Closes #157.
---
 .pre-commit-config.yaml => .editorconfig | 31 ++++++++++++++++---------------
 .pre-commit-config.yaml                  | 17 +++++++++++++++++
 .pre-commit-config.yaml => .shellcheckrc | 17 ++---------------
 ci/scripts/build.sh                      |  4 ++--
 dev/release/release.sh                   |  2 +-
 dev/release/verify_rc.sh                 | 20 ++++++++++----------
 6 files changed, 48 insertions(+), 43 deletions(-)

diff --git a/.pre-commit-config.yaml b/.editorconfig
similarity index 64%
copy from .pre-commit-config.yaml
copy to .editorconfig
index 3ad99e1..065f00f 100644
--- a/.pre-commit-config.yaml
+++ b/.editorconfig
@@ -15,18 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-repos:
-  - repo: local
-    hooks:
-      - id: rat
-        name: Release Audit Tool
-        language: system
-        entry: |
-          bash -c " \
-            git archive HEAD \
-              --prefix=apache-arrow-js/ \
-              --output=apache-arrow-js.tar.gz && \
-              dev/release/run_rat.sh apache-arrow-js.tar.gz && \
-              rm -f apache-arrow-js.tar.gz"
-        always_run: true
-        pass_filenames: false
+# This is an EditorConfig file: https://editorconfig.org/
+
+# This is the top-most config for this project
+root = true
+
+# General settings
+
+[*]
+charset = utf-8
+insert_final_newline = true
+spelling_language = en
+trim_trailing_whitespace = true
+
+[*.sh]
+indent_size = 2
+indent_style = space
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3ad99e1..73b12ad 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -30,3 +30,20 @@ repos:
               rm -f apache-arrow-js.tar.gz"
         always_run: true
         pass_filenames: false
+  - repo: https://github.com/koalaman/shellcheck-precommit
+    rev: v0.10.0
+    hooks:
+      - id: shellcheck
+        alias: shell
+  - repo: https://github.com/scop/pre-commit-shfmt
+    # v3.11.0-1 or later requires pre-commit 3.2.0 or later but Ubuntu
+    # 22.04 ships pre-commit 2.17.0. We can use update this rev after
+    # Ubuntu 22.04 reached EOL (June 2027).
+    rev: v3.10.0-1
+    hooks:
+      - id: shfmt
+        alias: shell
+        args:
+          # The default args is "--write --simplify" but we don't use
+          # "--simplify". Because it's conflicted will ShellCheck.
+          - "--write"
diff --git a/.pre-commit-config.yaml b/.shellcheckrc
similarity index 64%
copy from .pre-commit-config.yaml
copy to .shellcheckrc
index 3ad99e1..6eb7b22 100644
--- a/.pre-commit-config.yaml
+++ b/.shellcheckrc
@@ -15,18 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-repos:
-  - repo: local
-    hooks:
-      - id: rat
-        name: Release Audit Tool
-        language: system
-        entry: |
-          bash -c " \
-            git archive HEAD \
-              --prefix=apache-arrow-js/ \
-              --output=apache-arrow-js.tar.gz && \
-              dev/release/run_rat.sh apache-arrow-js.tar.gz && \
-              rm -f apache-arrow-js.tar.gz"
-        always_run: true
-        pass_filenames: false
+external-sources=true
+source-path=SCRIPTDIR
diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh
index 4914828..00cc0bd 100755
--- a/ci/scripts/build.sh
+++ b/ci/scripts/build.sh
@@ -31,9 +31,9 @@ yarn build
 if [ "${BUILD_DOCS_JS}" = "ON" ]; then
   # If upstream is defined, use it as remote.
   # Otherwise use origin which could be a fork on PRs.
-  if [[ "$(git config --get remote.upstream.url)" =~ 
"https://github.com/apache/arrow-js"; ]]; then
+  if [[ "$(git config --get remote.upstream.url)" =~ 
https://github.com/apache/arrow-js ]]; then
     yarn doc --gitRemote upstream
-  elif [[ "$(basename -s .git $(git config --get remote.origin.url))" == 
"arrow-js" ]]; then
+  elif [[ "$(basename -s .git "$(git config --get remote.origin.url)")" == 
"arrow-js" ]]; then
     yarn doc
   else
     echo "Failed to build docs because the remote is not set correctly. Please 
set the origin or upstream remote to https://github.com/apache/arrow-js.git.";
diff --git a/dev/release/release.sh b/dev/release/release.sh
index 2131b55..020537d 100755
--- a/dev/release/release.sh
+++ b/dev/release/release.sh
@@ -119,7 +119,7 @@ if [ "${RELEASE_PUBLISH}" -gt 0 ]; then
     --dir "." \
     --pattern "*.tgz" \
     --repo "${repository}"
-  read -p "Please enter your npm 2FA one-time password (or leave empty if you 
don't have 2FA enabled): " NPM_OTP </dev/tty
+  read -r -p "Please enter your npm 2FA one-time password (or leave empty if 
you don't have 2FA enabled): " NPM_OTP </dev/tty
   for package in *.tgz; do
     npm publish "${package}" "${NPM_OTP:+--otp=${NPM_OTP}}"
   done
diff --git a/dev/release/verify_rc.sh b/dev/release/verify_rc.sh
index f77938e..082ebb0 100755
--- a/dev/release/verify_rc.sh
+++ b/dev/release/verify_rc.sh
@@ -140,16 +140,16 @@ test_package_distributions() {
   rm -rf targets
   mkdir -p targets
   for target in apache-arrow \
-                  apache-arrow-es2015-cjs \
-                  apache-arrow-es2015-esm \
-                  apache-arrow-es2015-umd \
-                  apache-arrow-es5-cjs \
-                  apache-arrow-es5-esm \
-                  apache-arrow-es5-umd \
-                  apache-arrow-esnext-cjs \
-                  apache-arrow-esnext-esm \
-                  apache-arrow-esnext-umd \
-                  apache-arrow-ts; do
+    apache-arrow-es2015-cjs \
+    apache-arrow-es2015-esm \
+    apache-arrow-es2015-umd \
+    apache-arrow-es5-cjs \
+    apache-arrow-es5-esm \
+    apache-arrow-es5-umd \
+    apache-arrow-esnext-cjs \
+    apache-arrow-esnext-esm \
+    apache-arrow-esnext-umd \
+    apache-arrow-ts; do
     download_rc_file "${target}-${VERSION}.tgz"
     download_rc_file "${target}-${VERSION}.tgz.sha256"
     ${sha256_verify} "${target}-${VERSION}.tgz.sha256"

Reply via email to