use MISSING in place of None in pretty._main #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
on: | |
pull_request: | |
push: | |
workflow_dispatch: | |
env: | |
PYTHON_VERSION: 3.12 | |
jobs: | |
job: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install ${{ github.event.repository.name }} | |
run: |- | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install --upgrade . | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install pyright | |
run: npm install -g pyright | |
- name: Check | |
run: |- | |
pyright ./${{ github.event.repository.name }} --outputjson \ | |
| jq -r '.generalDiagnostics[] | [.file, .severity, .range.start.line+1, .range.start.character+1, .range.end.line+1, .range.end.character+1, .message] | @tsv' \ | |
| while IFS=$'\t' read -r file severity line col endLine endColumn message; do \ | |
severity=$([ "$severity" == "information" ] && echo "notice" || echo "$severity" ); \ | |
file=$(python -c "import os; print(os.path.relpath('$file', '.'))"); \ | |
echo "$file#L$line"; \ | |
echo "::$severity file=$file,line=$line,col=$col,endLine=$endLine,endColumn=$endColumn::$message"; \ | |
done | |
python3 -c "exit(${PIPESTATUS[0]})" | |
- name: Verify | |
run: |- | |
jsonOut=$(pyright --verifytypes ${{ github.event.repository.name }} --ignoreexternal --outputjson) || true | |
typeComplete=$(echo $jsonOut | jq -r '.summary.errorCount | if . == 0 then 0 else 1 end') | |
packageDir=$(echo $jsonOut | jq -r '.typeCompleteness.packageRootDirectory') | |
echo $jsonOut | jq -r '.typeCompleteness.symbols[].diagnostics[] | select((.file != "") and (.message | startswith("No docstring found") | not)) | [.file, .severity, has("range"), .range.start.line+1, .range.start.character+1, .range.end.line+1, .range.end.character+1, .message] | @tsv' \ | |
| while IFS=$'\t' read -r file severity hasRange line col endLine endColumn message; do \ | |
severity=$([ "$severity" == "information" ] && echo "notice" || echo "$severity" ); \ | |
file=$(python -c "import os; print(os.path.relpath('$file', os.path.dirname('$packageDir')))"); \ | |
if [ "$hasRange" == "true" ]; then \ | |
echo "$file#L$line"; \ | |
echo "::$severity title=Verify,file=$file,line=$line,col=$col,endLine=$endLine,endColumn=$endColumn::$message"; \ | |
else \ | |
echo "$file"; \ | |
echo "::$severity title=Verify,file=$file::$message"; \ | |
fi; \ | |
done | |
python -c "exit($typeComplete)" |