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

mypy w/ reviewdog (experiment) #369

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ jobs:
run: poetry run flake8

- name: Lint with mypy
run: poetry run mypy .
uses: tsuyoshicho/action-mypy@v3
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-review
# Change reporter level if you need.
# GitHub Status Check won't become failure with warning.
# level: warning
# Change the current directory to run mypy command.
# mypy command reads setup.cfg or other settings file in this path.
# workdir: .

- name: Print python versions
run: |
Expand Down
6 changes: 3 additions & 3 deletions libvcs/_internal/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def run(
shell: bool = False,
cwd: Optional[StrOrBytesPath] = None,
env: Optional[_ENV] = None,
universal_newlines: bool = False,
universal_newlines: Optional[bool] = None,
startupinfo: Optional[Any] = None,
creationflags: int = 0,
restore_signals: bool = True,
Expand Down Expand Up @@ -262,15 +262,15 @@ def progress_cb(output, timestamp):
umask=umask,
)

all_output: list[str] = []
all_output = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Need type annotation for "all_output" (hint: "all_output: List[] = ...")

code = None
line = None
while code is None:
code = proc.poll()

# output = console_to_str(proc.stdout.readline())
# all_output.append(output)
if callback and callable(callback) and proc.stderr is not None:
if callback and callable(callback):
line = console_to_str(proc.stderr.read(128))
if line:
callback(output=line, timestamp=datetime.datetime.now())
Expand Down