mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-01 19:48:35 +08:00
ci: add shellcheck linter (#6428)
This commit is contained in:
parent
c4229d15ef
commit
f31bef426e
15
.github/workflows/code-lint.yml
vendored
15
.github/workflows/code-lint.yml
vendored
@ -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
|
||||
git ls-files | grep ".sh$" | xargs -t shellcheck
|
||||
|
25
.shellcheckrc
Normal file
25
.shellcheckrc
Normal file
@ -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
|
@ -48,7 +48,7 @@ script() {
|
||||
sudo PATH=$PATH apisix start
|
||||
sudo PATH=$PATH apisix stop
|
||||
|
||||
cat /usr/local/apisix/logs/error.log | grep '\[error\]' > /tmp/error.log | true
|
||||
grep '\[error\]' /usr/local/apisix/logs/error.log > /tmp/error.log | true
|
||||
if [ -s /tmp/error.log ]; then
|
||||
echo "=====found error log====="
|
||||
cat /usr/local/apisix/logs/error.log
|
||||
|
@ -53,7 +53,7 @@ script() {
|
||||
# apisix cli test
|
||||
# todo: need a more stable way
|
||||
|
||||
cat /usr/local/apisix/logs/error.log | grep '\[error\]' > /tmp/error.log | true
|
||||
grep '\[error\]' /usr/local/apisix/logs/error.log > /tmp/error.log | true
|
||||
if [ -s /tmp/error.log ]; then
|
||||
echo "=====found error log====="
|
||||
cat /usr/local/apisix/logs/error.log
|
||||
|
Loading…
Reference in New Issue
Block a user