-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add shellcheck linter #6428
Changes from 4 commits
c734b16
56b6700
8f27197
fa549ac
38c7d0e
7c935af
92f3d06
1c191ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/ | ||
Comment on lines
+41
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use apt install -y shellcheck There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way is ok to install
The package must uniformly install from repo unless no supported, I'll improve installation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM, let keep it this way. Thanks for replying. |
||
shellcheck --version | ||
shellcheck **/*.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's limit the scope. We don't want to lint the code from git submodule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I got the meaning that checkout repo without submodule, so it won't lint the code from git submodule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
? It is still linting all the shell files in this repo, including the one from submodule... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solution 1: not checkout submodule, then this won't lint shell files in submodule 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Specify file and dirs to lint had been done. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
# wiki link pattern https://github.com/koalaman/shellcheck/wiki/{code} | ||
# like SC2148, links to https://github.com/koalaman/shellcheck/wiki/SC2148 | ||
|
||
disable=SC1083,SC1091 | ||
disable=SC2002,SC2004,SC2006,SC2009,SC2010,SC2016,SC2024,SC2027,SC2034,SC2046,SC2048,SC2059 | ||
disable=SC2068,SC2076,SC2086,SC2089,SC2090 | ||
disable=SC2103,SC2126,SC2143,SC2148,SC2155,SC2157,SC2164,SC2181 | ||
disable=SC2215,SC2216,SC2251,SC2260,SC3037 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use
-J
here ?Can it replace with
-z
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's format is
tar.xz
nottar.gz
-J
filter the archive through xz-z
filter the archive through gzip