You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/23 10:28:58 UTC

[GitHub] [apisix] kwanhur opened a new pull request #6428: ci: add shellcheck linter

kwanhur opened a new pull request #6428:
URL: https://github.com/apache/apisix/pull/6428


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   use [ShellCheck](https://github.com/koalaman/shellcheck) to analysis shell scripts and gives warnings and suggestions.
   
   intention: import shell script's quality
   
   test case [SC2148](https://github.com/kwanhur/apisix/runs/5301576428?check_suite_focus=true)
   
   `.shellcheckrc` to enable/disable shellcheck code(equals rule), content now comes from existed shell scripts.
   
   - cause all of them had run successfully, so a lot of rules disable
   
   <!--- If it fixes an open issue, please link to the issue here. -->
   https://github.com/apache/apisix/pull/6320#issuecomment-1039907522
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the PR manners:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
   6. Use "request review" to notify the reviewer once you have resolved the review
   7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
   -->
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6428:
URL: https://github.com/apache/apisix/pull/6428


   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1053995098


   [build (ubuntu-18.04, linux_openresty_1_17, t/plugin)](https://github.com/apache/apisix/runs/5355589130?check_suite_focus=true#logs) runs failed, it's not related to `shellcheck`, please trigger re-run the job.
   
   from the logs, seems that grpc server launch abnormally.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1050550756


   mentioned PRs differ goal:
   
   - #6320 modify search error logicality, reduce one command.
   - #6428 add code(shell script) limitation.
   
   I think they're should stay with two, one PR reaches one goal. Of cause, still need they squash into one, I'll take it.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r818391833



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,18 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck benchmark/*.sh bin/apisix ci/*.sh ci/pod/nacos/healthcheck/*.sh t/cli/*.sh t/plugin/grpc-web/*.sh utils/*.sh

Review comment:
       Yep, it's better. `xargs -t shellcheck` echo the command to be executed, it'll show which files to check.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r816604421



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       Ok, I got the meaning that checkout repo without submodule, so it won't lint the code from git submodule.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r815566024



##########
File path: ci/common.sh
##########
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+# shellcheck disable=SC2148

Review comment:
       Sure, but why use
   
   > enable=SC2148
   
   in https://github.com/apache/apisix/pull/6428/files#diff-c71502ae2fb6ee770263dbf93031c6bb1549ef6b2970b862daf24d01a1ded277R22?
   
   Could we keep it disabled? Look like the check is enabled by you.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r818244525



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,18 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck benchmark/*.sh bin/apisix ci/*.sh ci/pod/nacos/healthcheck/*.sh t/cli/*.sh t/plugin/grpc-web/*.sh utils/*.sh

Review comment:
       Would be better to use `git ls-files | grep "\.sh$" | xargs`




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander edited a comment on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander edited a comment on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1050460171


   I mean squashing the modification in https://github.com/apache/apisix/pull/6320 to this PR. **It is bad to split a tiny change into multiple PRs.** And if you want to solve more shellcheck warnings, please do it in this PR. 
   
   Don't bombard with other shellcheck relative PR anymore. 


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r815429692



##########
File path: ci/common.sh
##########
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+# shellcheck disable=SC2148

Review comment:
       I think it is quite strange to add a warning and disable it later. Let's remove it.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r813572534



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv

Review comment:
       Because it's format is `tar.xz` not `tar.gz`
   
   - `-J` filter the archive through xz
   - `-z` filter the archive through gzip




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r817305089



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       Solution 1: not checkout submodule, then this won't lint shell files in submodule
   ```yaml
       steps:
         - name: Checkout code
           uses: actions/checkout@v2.4.0
   ```
   
   Solution 2: specify shellcheck paths, exclude submodule, so it won't lint in submodule
   
   From this tip, I think you mean the solution 2.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] leslie-tsang commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r813479868



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/

Review comment:
       can we use `apt` to install `spellcheck` ?
   like
   ```bash
   apt install -y shellcheck
   ```

##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv

Review comment:
       ```suggestion
             wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
   ```
   Why use `-J` here ?
   
   Can it replace with `-z` ?




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r817275345



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       > shellcheck **/*.sh
   
   ? It is still linting all the shell files in this repo, including the one from submodule...




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r817309848



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       > > shellcheck **/*.sh
   > 
   > ? It is still linting all the shell files in this repo, including the one from submodule...
   
   Specify file and dirs to lint had been done.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r815602616



##########
File path: ci/common.sh
##########
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+# shellcheck disable=SC2148

Review comment:
       Had disable it.
   
   Actually, all the rules enable by default. Here, I mark it obviously.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r813580415



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/

Review comment:
       This way is ok to install `shellcheck`, but I'm not sure its repository updates to latest version.
   
   1. latest version may add new check rules and it covers the before.
   2. different developers use different version, the latest covers them.
   
   The package must uniformly install from repo unless no supported, I'll improve installation.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1050564661


   Anyway, they had been done.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r816607893



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       > Let's limit the scope. We don't want to lint the code from git submodule.
   
   Done.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r816415289



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/
+          shellcheck --version
+          shellcheck **/*.sh

Review comment:
       Let's limit the scope. We don't want to lint the code from git submodule.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r815545202



##########
File path: ci/common.sh
##########
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+# shellcheck disable=SC2148

Review comment:
       SC2148(Add a shebang) rule has enabled, remove it `ci code-lint` will run failed. 
   The key point is that, all the scripts have the shebang but `ci/common.sh` and `t/cli/common.sh`.
   
   `disable` in script file, just scope the file, no influences on the other.
   
   To fix the check failure, three solutions to choose:
   
   1. enable SC2148 and add shellcheck disable declaration(just like now), test case [SC2148](https://github.com/kwanhur/apisix/runs/5301576428?check_suite_focus=true).
   2. enable SC2148 and add a shebang in `common.sh`, but it seems not so suitable, like https://github.com/apache/apisix/pull/6340#discussion_r809653666.
   3. disable SC2148, this will not find it when add a script without shebang.
   
   Summary, solution 1 could be the better.
   Hope your voice.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1050460171


   I mean squashing the modification in https://github.com/apache/apisix/pull/6320 to this PR. **It is bad to split a tiny change across multiple PRs.** And if you want to solve more shellcheck warnings, please do it in this PR. 
   
   Don't bombard with other shellcheck relative PR anymore. 


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] kwanhur commented on pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
kwanhur commented on pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#issuecomment-1049849386


   > Good, let's add #6320 to this PR.
   
   Had linked to here.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] leslie-tsang commented on a change in pull request #6428: ci: add shellcheck linter

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on a change in pull request #6428:
URL: https://github.com/apache/apisix/pull/6428#discussion_r813606359



##########
File path: .github/workflows/code-lint.yml
##########
@@ -28,3 +28,20 @@ jobs:
         . ./ci/common.sh
         export_or_prefix
         make lint
+
+  sc-lint:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2.4.0
+        with:
+          submodules: true
+
+      - name: Shellcheck code
+        run: |
+          scversion="latest"
+          wget -O- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
+          cp -av "shellcheck-${scversion}/shellcheck" /usr/local/bin/

Review comment:
       LGTM, let keep it this way. 
   
   Thanks for replying.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org