only call .replace if object exists #65
Workflow file for this run
This file contains hidden or 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: Test Code on PR | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Create reports folders | |
| run: | | |
| mkdir -p reports/coverage && mkdir -p reports/flake8 && mkdir -p reports/bandit && mkdir -p reports/mypy | |
| - name: Lint with flake8 | |
| continue-on-error: true | |
| run: | | |
| flake8 . --count --select=E101,E111,E201,E202,E203,E231,E302,E731,E9,F401,F403,F405,F811,F7 --exit-zero --max-complexity=10 --max-line-length=100 --format=pylint --output-file=reports/flake8/report.txt | |
| - name: Security analysis with bandit | |
| continue-on-error: true | |
| run: | | |
| bandit -r . -c pyproject.toml -f json -o reports/bandit/report.json | |
| - name: Type check with mypy | |
| continue-on-error: true | |
| run: | | |
| mypy . --show-error-codes --no-error-summary >> reports/mypy/index.txt | |
| - name: Run tests with pytest | |
| env: | |
| API_KEY: ${{ secrets.MBTA_API_KEY }} | |
| run: | | |
| pytest --cov-report=html:reports/coverage/ | |
| - name: Zip reports folder | |
| run: | | |
| zip -r reports.zip reports/ | |
| - name: Upload reports as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: reports | |
| path: reports.zip |