From ed406263872c2852e05d91096c37e2042a81330b Mon Sep 17 00:00:00 2001 From: Max Dymond Date: Tue, 5 Mar 2024 13:25:17 +0000 Subject: [PATCH] Add CI for linting --- .github/dependabot.yml | 12 ++++++++++++ .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ dev-requirements.txt | 5 +++++ function_app.py | 4 ++-- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 dev-requirements.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ed65280 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: pip + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..542e240 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: Lint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r dev-requirements.txt + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') + - name: Analysing the code with mypy + run: | + mypy $(git ls-files '*.py') diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..2b29fcf --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,5 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +pylint +mypy diff --git a/function_app.py b/function_app.py index fb26b33..c4761df 100644 --- a/function_app.py +++ b/function_app.py @@ -209,8 +209,8 @@ def blob_trigger(newfile: func.InputStream): @app.function_name(name="eventGridTrigger") @app.event_grid_trigger(arg_name="event") -def eventGridTrigger(event: func.EventGridEvent): - """Process an event grid trigger for a new blob in the container""" +def event_grid_trigger(event: func.EventGridEvent): + """Process an event grid trigger for a new blob in the container.""" log.info("Processing event %s", event.id) rm = RepoManager() rm.check_metadata()