summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-02-13 15:46:51 +0900
committerGitHub <[email protected]>2021-02-13 15:46:51 +0900
commit9a9c95986a2bb5d647f7a610c04987cd2b9397f4 (patch)
tree8633cea9ea49d12fc2c4595e27beadfa3e9610db
parent8e01fc89336811d4200a2017e229b1b2a1b23e8f (diff)
parentd55a74c4187837347f8edbdd034e28cfee1e9a15 (diff)
downloadmruby-9a9c95986a2bb5d647f7a610c04987cd2b9397f4.tar.gz
mruby-9a9c95986a2bb5d647f7a610c04987cd2b9397f4.zip
Merge pull request #5341 from jbampton/check-for-trailing-whitespace
feat(CI): check for trailing whitespace
-rw-r--r--.github/workflows/lint.yml9
-rw-r--r--mrbgems/mruby-hash-ext/src/hash-ext.c2
-rwxr-xr-xtest/check-for-trailing-whitespace.sh13
3 files changed, 23 insertions, 1 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index b2ba316b2..48af6619f 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -31,3 +31,12 @@ jobs:
node-version: '12.x'
- run: npm install -g [email protected]
- run: markdownlint '**/*.md'
+ trailing-whitespace:
+ name: ๐ŸŒŒ Trailing whitespace
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: ๐Ÿงน Check for trailing whitespace
+ run: |
+ cd test || exit
+ sh ./check-for-trailing-whitespace.sh || exit 1
diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c
index 6345420ed..9c85858fe 100644
--- a/mrbgems/mruby-hash-ext/src/hash-ext.c
+++ b/mrbgems/mruby-hash-ext/src/hash-ext.c
@@ -74,7 +74,7 @@ hash_slice(mrb_state *mrb, mrb_value hash)
* hsh.except(*keys) -> a_hash
*
* Returns a hash excluding the given keys and their values.
- *
+ *
* h = { a: 100, b: 200, c: 300 }
* h.except(:a) #=> {:b=>200, :c=>300}
* h.except(:b, :c, :d) #=> {:a=>100}
diff --git a/test/check-for-trailing-whitespace.sh b/test/check-for-trailing-whitespace.sh
new file mode 100755
index 000000000..00be038f3
--- /dev/null
+++ b/test/check-for-trailing-whitespace.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+cd .. || exit
+# print first
+grep -EHInr '( +)$' ./*
+
+var=$(grep -EHInr '( +)$' ./*)
+# then exit with fail if found
+if test -z "$var"; then
+ exit 0
+else
+ exit 1
+fi