Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Pass Options to Action #54

Open
AntumDeluge opened this issue Aug 9, 2022 · 1 comment
Open

Can't Pass Options to Action #54

AntumDeluge opened this issue Aug 9, 2022 · 1 comment

Comments

@AntumDeluge
Copy link

AntumDeluge commented Aug 9, 2022

I am using v3 & can't seem to pass any options to Mypy. The README says to use mypy_flags.

      - name: Mypy action
        uses: jashparekh/mypy-action@v3
        id: mypy
        with:
          path: "src/*.py"
          mypy_flags: '--allow-untyped-globals'

Result:

Warning: Unexpected input(s) 'mypy_flags', valid inputs are ['path', 'mypy_version', 'mypy_config_file', 'mypy_options', 'requirements', 'requirement_files', 'python_version']
...
...
+ mypy_args=
+ output_file=/tmp/mypy.out
+ lint_path='src/*.py'
+ mypy_version=
+ mypy_config_file=
+ flags=
+ requirements=
+ requirements_files=
...
...
+ mypy --version
mypy 0.971 (compiled: yes)
+ '[' '!' -z '' ']'
+ '[' '!' -z '' ']'
+ mypy --show-column-numbers --hide-error-context src/bin2header.py
+ tee /tmp/mypy.out
src/bin2header.py:29:1: error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
Found 1 error in 1 file (checked 1 source file)
+ exit_code=1
+ python /github.py /tmp/mypy.out
Error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
+ exit 1
Error: Process completed with exit code 1.

So I tried the following:

      - name: Mypy action
        uses: jashparekh/mypy-action@v3
        id: mypy
        with:
          path: "src/*.py"
          mypy_options: '--allow-untyped-globals'

Result:

+ mypy_args=
+ output_file=/tmp/mypy.out
+ lint_path='src/*.py'
+ mypy_version=
+ mypy_config_file=
+ flags=--allow-untyped-globals
+ requirements=
+ requirements_files=
...
...
+ mypy --version
mypy 0.971 (compiled: yes)
+ '[' '!' -z '' ']'
+ '[' '!' -z --allow-untyped-globals ']'
+ mypy_args += ' --allow-untyped-globals'
/entrypoint.sh: line 44: mypy_args: command not found
+ mypy --show-column-numbers --hide-error-context src/bin2header.py
+ tee /tmp/mypy.out
src/bin2header.py:29:1: error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
Found 1 error in 1 file (checked 1 source file)
+ exit_code=1
+ python /github.py /tmp/mypy.out
Error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
+ exit 1
Error: Process completed with exit code 1.

I also tried downgrading to v2 but got same result.

I am able to use the flag on my local system:

$ mypy --version
mypy 0.971 (compiled: no)

$ mypy --allow-untyped-globals src/*.py
Success: no issues found in 1 source file

I am going to try setting mypy_version & will update this with the result.

Edit:

I realized that v3 uses the same Mypy version as my system & v2 uses 0.910. So doesn't seems to be an issue with the Mypy version.

Edit:

Tried downgrading to v1 but problem persists:

      - name: Mypy action
        uses: jashparekh/mypy-action@v1
        id: mypy
        with:
          path: "src/*.py"
          mypy_flags: '--allow-untyped-globals'

Result:

+ mypy_args=
+ output_file=/tmp/mypy.out
+ lint_path='src/*.py'
+ mypy_version=0.910
+ mypy_config_file=
+ flags=--allow-untyped-globals
+ pip install mypy==0.910
...
...
+ mypy --version
mypy 0.910
+ '[' ']'
+ '[' --allow-untyped-globals ']'
+ mypy_args += ' --allow-untyped-globals'
/entrypoint.sh: line 28: mypy_args: command not found
+ tee /tmp/mypy.out
+ mypy --show-column-numbers --hide-error-context src/bin2header.py
src/bin2header.py:29:1: error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
Found 1 error in 1 file (checked 1 source file)
+ exit_code=1
+ python /github.py /tmp/mypy.out
Error: Need type annotation for "options" (hint: "options: Dict[<type>, <type>] = ...")
+ exit 1
@AntumDeluge
Copy link
Author

I have switched to jpetrucciani/mypy-check & that is working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant