diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..3f2018d4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint with flake8 +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: 3.10 + - name: Install dependencies + run: | + python -m pip install flake8 + - name: Lint with flake8 + run: | + make lint diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..37576b92 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +# Lint requirements: flake8, autopep8, autoflake +# Run `python -m pip install autopep8 flake8 autoflake` to install them + +.PHONY: lint +lint: + flake8 ./ --exclude .venv,*_pb2.py --max-line-length=150 --ignore=F403,F405,F541 + +.PHONY: format +format: + autopep8 --in-place --aggressive --aggressive --recursive ./ --exclude .venv,*_pb2.py --max-line-length=150 + autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables ./ --exclude .venv