Skip to content

Commit e8b6456

Browse files
committed
Add mypy validation action
1 parent 50d3029 commit e8b6456

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.github/workflows/mypy.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# For documentation on GitHub Actions Workflows, see:
2+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
3+
name: MyPy
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
mypy:
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest]
12+
python-version: [3.9]
13+
fail-fast: false
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v2 # https://github.com/actions/checkout
17+
with:
18+
# Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
19+
# Set fetch-depth: 0 to fetch all history for all branches and tags.
20+
fetch-depth: 0 # Needed for setuptools_scm to work correctly
21+
- name: Set up Python
22+
uses: actions/setup-python@v2 # https://github.com/actions/setup-python
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install python prerequisites
26+
run: pip install -U --user pip setuptools setuptools-scm mypy
27+
- name: MyPy
28+
run: python -m mypy cmd2

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def __init__(
399399
if os.path.exists(startup_script):
400400
script_cmd = "run_script {}".format(utils.quote_string(startup_script))
401401
if silent_startup_script:
402-
script_cmd += "> {}".format(os.devnull)
402+
script_cmd += " > {}".format(os.devnull)
403403
self._startup_commands.append(script_cmd)
404404

405405
# Transcript files to run instead of interactive command loop

cmd2/table_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, cols: Sequence[Column], *, tab_width: int = 4) -> None:
138138

139139
# For headers with the width not yet set, use the width of the
140140
# widest line in the header or 1 if the header has no width
141-
if col.width < 0:
141+
if col.width <= 0:
142142
col.width = max(1, ansi.widest_line(col.header))
143143

144144
@staticmethod

0 commit comments

Comments
 (0)