1- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41name : Python package
52
63on :
@@ -20,21 +17,32 @@ jobs:
2017
2118 steps :
2219 - uses : actions/checkout@v4
20+
2321 - name : Set up Python ${{ matrix.python-version }}
2422 uses : actions/setup-python@v3
2523 with :
2624 python-version : ${{ matrix.python-version }}
25+
2726 - name : Install dependencies
2827 run : |
2928 python -m pip install --upgrade pip
3029 python -m pip install flake8 pytest
3130 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
3232 - name : Lint with flake8
3333 run : |
34- # stop the build if there are Python syntax errors or undefined names
35- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+ echo "🔍 Checking for null bytes in Python files..."
35+ if grep -rl $'\x00' --include="*.py" .; then
36+ echo "❌ Found null bytes in Python source files!"
37+ exit 1
38+ fi
39+
40+ echo "✅ Running flake8 only on Python files..."
41+ # Stop the build on syntax errors/undefined names
42+ flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
43+ # Style checks (won't fail build)
44+ flake8 --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
45+
3846 - name : Test with pytest
3947 run : |
4048 pytest
0 commit comments