Lint error while running dockerized project on Github Actions

64 Views Asked by At

This is the error that I'm getting while running my GH Actions:

Test and Lint

- Setup job - Done
- Checkout - Done
- Test - Done
- Lint
    Run docker-compose run —rm app sh -c “flake8”
    Creating recipe_app_api_app_run …
    Creating recipe_app_api_app_run … done
    ./core/management/commands/wait_for_db.py:5:57: W291 trailing whitespace
    ./core/management/commands/wait_for_db.py:23:73 W292 no newline end of file
    ./core/management/commands/wait_for_db.py:28:1 W391 blank line at end of file
    1
    Error: Process completed with exit code 1

Here is my setup for github actions:

---
name: Checks

on: [push]

jobs:
  test-lint:
    name: Test and Lint
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Test
        run: docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test"
      - name: Lint
        run: docker-compose run --rm app sh -c "flake8"
1

There are 1 best solutions below

2
allexiusw On

The issue that you are facing is that you have some extra spaces in the file wait_for_db.py specifically in lines 5 and also you need to add an empty line at the and of this file 23. Also you have to make sure you only have one line the end of the test_commands.py.

Errors:

You can get a clear explanation of each flake8 rule in the following link: https://www.flake8rules.com/