Skip to content

Commit

Permalink
fix: README and action.yml/script.sh support json
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshicho committed Jul 27, 2024
1 parent 0f382bd commit df9bbd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This is a action-mypy repository for [reviewdog](https://github.com/reviewdog/re
**It handles the error line by line.**
see [Issue](https://github.com/tsuyoshicho/action-mypy/issues/38).

**This action require mypy==1.11 or higher**

Notice:
This action is `composition action`.

Expand Down Expand Up @@ -118,6 +120,10 @@ inputs:
default: 'mypy'
ignore_note:
description: |
Currentry always enable this option
Ignore error context NOTE: entry
old description:
Ignore note entry.
mypy report some error with optional note entry.
This option is workaround.
Expand All @@ -128,9 +134,7 @@ inputs:
`mypy_flags` is used for workflow setting. (eg '--strict --strict-equality').

But when this flag as set, ignore and do not affect setup.cfg or other mypy's settings file parameters.

Use this flag when you want to check a workflow that is different from the project settings.
Currentry always suppress note.

## Usage

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ inputs:
default: 'mypy'
ignore_note:
description: |
Currentry always enable this option
Ignore error context NOTE: entry
old description:
Ignore note entry.
mypy report some error with optional note entry.
This option is workaround.
Expand All @@ -117,7 +121,7 @@ runs:
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
INPUT_MYPY_FLAGS: ${{ inputs.mypy_flags }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_IGNORE_NOTE: ${{ inputs.ignore_note }}
# INPUT_IGNORE_NOTE: ${{ inputs.ignore_note }}
INPUT_INSTALL_TYPES: ${{ inputs.install_types }}
# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
Expand Down
18 changes: 7 additions & 11 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,23 @@ set +e
# first, user flags
# second, set reviewdog supplement flags(abspath, column num) and suppress pretty flag
# same flag: win later
# --hide-error-context : suppress error context NOTE: entry
# shellcheck disable=SC2086
mypy_check_output="$(${INPUT_EXECUTE_COMMAND} \
${INPUT_MYPY_FLAGS} \
--output json \
--hide-error-context \
--show-column-numbers \
--show-absolute-path \
--no-pretty \
${TARGETS_LIST} 2>&1 \
)" || mypy_exit_val="$?"

IGNORE_NOTE_EFM_OPTION=()
if [[ "${INPUT_IGNORE_NOTE}" == "true" ]] ; then
# note ignore
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" \
echo "${mypy_check_output}" | \
python ./mypy_to_rdjson/mypy_to_rdjson.py | \
reviewdog \
-f=rdjson \
-name="${INPUT_TOOL_NAME:-mypy}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
Expand Down

0 comments on commit df9bbd7

Please sign in to comment.