Add minimal lint workflow

This commit is contained in:
sfan5
2024-03-02 18:53:14 +01:00
parent 12ed8aff60
commit d945b26f9f
2 changed files with 29 additions and 4 deletions

28
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: lint
on:
push:
paths:
- '**.py'
- 'requirements.txt'
pull_request:
paths:
- '**.py'
- 'requirements.txt'
jobs:
pylint:
runs-on: ubuntu-latest
container:
image: python:3.11-slim
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
pip install -r requirements.txt
pip install pylint
- name: Lint
run: |
pylint -E --fail-on=E server.py

View File

@@ -33,10 +33,7 @@ def geoip_lookup_continent(ip):
if not reader:
return
try:
geo = reader.get(ip)
except geoip2.errors.GeoIP2Error:
return
if geo and "continent" in geo:
return geo["continent"]["code"]