Skip to content

Commit

Permalink
refactor: ignore note option
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshicho committed Mar 4, 2023
1 parent c5a0a5a commit db8b72a
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,24 @@ mypy_check_output="$(mypy --show-column-numbers \
"${INPUT_TARGET:-.}" 2>&1 \
)" || mypy_exit_val="$?"

IGNORE_NOTE_EFM_OPTION=""
if [[ "${INPUT_IGNORE_NOTE}" == "true" ]] ; then
# note ignore
# shellcheck disable=SC2086
echo "${mypy_check_output}" | reviewdog \
-efm="%-G%f:%l:%c: note: %m" \
-efm="%f:%l:%c: %t%*[^:]: %m" \
-efm="%f:%l: %t%*[^:]: %m" \
-efm="%f: %t%*[^:]: %m" \
-name="${INPUT_TOOL_NAME:-mypy}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || reviewdog_exit_val="$?"
else
# shellcheck disable=SC2086
echo "${mypy_check_output}" | reviewdog \
-efm="%f:%l:%c: %t%*[^:]: %m" \
-efm="%f:%l: %t%*[^:]: %m" \
-efm="%f: %t%*[^:]: %m" \
-name="${INPUT_TOOL_NAME:-mypy}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || reviewdog_exit_val="$?"
IGNORE_NOTE_EFM_OPTION="-efm=\"%-G%f:%l:%c: note: %m\""
fi

# shellcheck disable=SC2086
echo "${mypy_check_output}" | reviewdog \
${IGNORE_NOTE_EFM_OPTION} \
-efm="%f:%l:%c: %t%*[^:]: %m" \
-efm="%f:%l: %t%*[^:]: %m" \
-efm="%f: %t%*[^:]: %m" \
-name="${INPUT_TOOL_NAME:-mypy}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || reviewdog_exit_val="$?"
echo '::endgroup::'

# Throw error if an error occurred and fail_on_error is true
Expand Down

0 comments on commit db8b72a

Please sign in to comment.