From d945b26f9f0fc0f57a5a009809e02e770991012a Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 2 Mar 2024 18:53:14 +0100 Subject: [PATCH] Add minimal lint workflow --- .github/workflows/lint.yml | 28 ++++++++++++++++++++++++++++ server.py | 5 +---- 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..04ba37a --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/server.py b/server.py index 5c30d50..32f60c3 100755 --- a/server.py +++ b/server.py @@ -33,10 +33,7 @@ def geoip_lookup_continent(ip): if not reader: return - try: - geo = reader.get(ip) - except geoip2.errors.GeoIP2Error: - return + geo = reader.get(ip) if geo and "continent" in geo: return geo["continent"]["code"]