Create pep8-linter.yml

This commit is contained in:
Sebastian Raschka 2024-03-18 07:00:28 -05:00 committed by GitHub
parent 48253c4f88
commit e213a0cede

30
.github/workflows/pep8-linter.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Python PEP8 Linting
# Define triggers for the workflow: run on push and pull request to the main branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install flake8
run: pip install flake8
- name: Run flake8 with exceptions
run: |
# Run flake8 with customized settings
flake8 . --max-line-length=120 \ # Set max line length to 120 characters
--ignore=W504,E402,E731,C406,E741 # Ignore specific PEP 8 warnings/errors
# W504: Allow line break after binary operator
# E402: Allow module level import not at top of file
# E731: Allow lambda expressions to be assigned
# C406: Allow unnecessary list literals (instead of dict literals)
# E741: Allow ambiguous variable names like 'l', 'O', or 'I'