Skip to content

Commit 9a947c0

Browse files
author
JimmyYang20
committed
Add check pylint in CI
Signed-off-by: JimmyYang20 <[email protected]>
1 parent b317015 commit 9a947c0

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

.github/workflows/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
run: pycodestyle lib
5151
working-directory: ${{ env.CODE_DIR }}
5252

53+
- name: Run pyton lint test
54+
run: make pylint
55+
working-directory: ${{ env.CODE_DIR }}
56+
5357
build:
5458
runs-on: ubuntu-latest
5559
name: build gm and lc

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ lint:
119119
hack/make-rules/lint.sh
120120
endif
121121

122+
define PYLINT_HELP_INFO
123+
# run python lint check.
124+
#
125+
# Example:
126+
# make pylint
127+
# make pylint HELP=y
128+
endef
129+
.PHONY: pylint
130+
ifeq ($(HELP),y)
131+
pylint:
132+
@echo "$$PYLINT_HELP_INFO"
133+
else
134+
pylint:
135+
hack/make-rules/pylint.sh
136+
endif
137+
122138
define CLEAN_HELP_INFO
123139
# Clean up the output of make.
124140
#

hack/make-rules/pylint.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2020 The KubeEdge Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
SEDNA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
22+
23+
source "${SEDNA_ROOT}/hack/lib/init.sh"
24+
25+
export PATH=$PATH:$(go env GOPATH)/bin
26+
27+
install_pylint() {
28+
echo "installing pylint"
29+
python3 -m pip install -U pylint
30+
if [[ $? -ne 0 ]]; then
31+
echo "failed to install pylint, exiting."
32+
exit 1
33+
fi
34+
}
35+
36+
check_pylint() {
37+
echo "checking pylint"
38+
install_pylint
39+
pylint ${SEDNA_ROOT}/lib
40+
}
41+
42+
check_pylint

0 commit comments

Comments
 (0)