fix github action lint error #4
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: Code Style Check | |
on: | |
push: | |
branches: | |
- main # 当代码推送到 main 分支时触发 | |
pull_request: | |
branches: | |
- main # 当对 main 分支发起 Pull Request 时触发 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 # 拉取代码仓库内容 | |
- name: Set up Python environment | |
uses: actions/setup-python@v4 # 设置 Python 环境 | |
with: | |
python-version: '3.10.13' # 指定 Python 版本 | |
- name: Install flake8 | |
run: pip install flake8 # 安装代码风格检测工具 flake8 | |
- name: Run flake8 | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Upload flake8 report | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: flake8-report | |
path: flake8-report.txt |