File tree Expand file tree Collapse file tree 2 files changed +60
-28
lines changed
Expand file tree Collapse file tree 2 files changed +60
-28
lines changed Original file line number Diff line number Diff line change 3636 - name : Lint with pylint
3737 run : |
3838 source venv/bin/activate
39- pylint -E 'x86-feature-check.py'
40-
41- typecheck :
42- name : ' Type Check'
43- runs-on : ubuntu-latest
44- steps :
45- - name : Checkout code
46- uses : actions/checkout@v6
47-
48- - name : Set up Python
49- uses : actions/setup-python@v6
50-
51- - name : Install dev dependencies
52- run : |
53- python -m venv venv
54- source venv/bin/activate
55- python -m pip install --no-cache-dir --upgrade pip wheel setuptools
56- python -m pip install --no-cache-dir --upgrade -r requirements-dev.txt
57-
58- - name : Check types with mypy
59- run : |
60- source venv/bin/activate
61- mypy --check-untyped-defs 'x86-feature-check.py'
62-
63- - name : Check types with pytype
64- run : |
65- source venv/bin/activate
66- pytype 'x86-feature-check.py'
39+ scripts/lint.sh
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ SCRIPT_DIR=" $( cd " $( dirname " $( realpath " $0 " ) " ) " && pwd -P) "
4+ PROJECT_ROOT=" $( cd " $SCRIPT_DIR /.." && pwd -P) "
5+
6+ # Change directory to project root
7+ cd " $PROJECT_ROOT " || exit 1
8+
9+ BINARY=' x86-feature-check.py'
10+
11+ # Whether or not an error occurred
12+ errors=' no'
13+
14+
15+ if ! command -v mypy > /dev/null 2> /dev/null; then
16+ echo ' Error: Can not run mypy!' > /dev/stderr
17+ echo ' mypy is not installed!' > /dev/stderr
18+ else
19+ echo ' Running mypy...'
20+ if ! mypy $BINARY ; then
21+ errors=' yes'
22+ fi
23+ fi
24+ echo ' '
25+ echo ' '
26+
27+
28+ if ! command -v pytype > /dev/null 2> /dev/null; then
29+ echo ' Error: Can not run pytype!' > /dev/stderr
30+ echo ' pytype is not installed!' > /dev/stderr
31+ else
32+ echo ' Running pytype...'
33+ if ! pytype $BINARY > /dev/null 2> /dev/null; then
34+ errors=' yes'
35+ fi
36+ fi
37+ echo ' '
38+ echo ' '
39+
40+
41+ if ! command -v pylint > /dev/null 2> /dev/null; then
42+ echo ' Error: Can not run pylint!' > /dev/stderr
43+ echo ' pylint is not installed!' > /dev/stderr
44+ else
45+ echo ' Running pylint...'
46+ pylint --exit-zero $BINARY
47+ if ! pylint --errors-only $BINARY > /dev/null 2> /dev/null; then
48+ errors=' yes'
49+ fi
50+ fi
51+ echo ' '
52+ echo ' '
53+
54+
55+ # Return with error code if any linter returned an error
56+ if [ " $errors " = ' yes' ]; then
57+ exit 1
58+ fi
59+
You can’t perform that action at this time.
0 commit comments