forked from dciborow/action-pylint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint.sh
executable file
·54 lines (41 loc) · 1.63 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -eu # Increase bash strictness
shopt -s globstar # Enable globstar
if [[ -n "${GITHUB_WORKSPACE}" ]]; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
fi
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
export REVIEWDOG_VERSION=v0.14.1
echo "[action-pylint] Installing reviewdog..."
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /tmp "${REVIEWDOG_VERSION}"
echo "[action-pylint] Installing pylint package..."
pip install --force-reinstall pylint==2.17.4
echo "[action-pylint] pylint version:"
pylint --version
if [[ "$INPUT_PYLINT_RC" == "" ]]; then
# Do not supply the rcfile option if it is not provided
rcfile_option=""
else
rcfile_option="--rcfile=${INPUT_PYLINT_RC}"
fi
echo "[action-pylint] Checking python code with the pylint linter and reviewdog..."
exit_val="0"
echo "rcfile_option=${rcfile_option}"
echo "INPUT_PYLINT_ARGS=${INPUT_PYLINT_ARGS}"
echo "INPUT_GLOB_PATTERN=${INPUT_GLOB_PATTERN}"
ls -alt
cmd_line="pylint --score n ${rcfile_option} ${INPUT_PYLINT_ARGS} ${INPUT_GLOB_PATTERN} 2>&1"
echo ${cmd_line}
pylint --score n ${rcfile_option} ${INPUT_PYLINT_ARGS} ${INPUT_GLOB_PATTERN} 2>&1 | # Removes ansi codes see https://github.com/reviewdog/errorformat/issues/51
/tmp/reviewdog -efm="%f:%l:%c: %m" \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || exit_val="$?"
echo "[action-pylint] Clean up reviewdog..."
rm /tmp/reviewdog
if [[ "${exit_val}" -ne '0' ]]; then
exit 1
fi