From 5e52c5a9d65bc272e64da4dc22cd0b1c57d2369a Mon Sep 17 00:00:00 2001 From: nikilok Date: Wed, 9 Jul 2025 12:41:20 +0100 Subject: [PATCH 1/3] adding a github runner task to validate prs follow certain standards before merging --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6823182 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: Python CI + +on: + pull_request: + branches: [main, master] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install Poetry + run: | + pip install poetry + + - name: Install dependencies + run: | + poetry install --no-interaction --no-root + + - name: Run black (formatting check) + run: | + poetry run black --check . + + - name: Run isort (import order check) + run: | + poetry run isort --check-only . + + - name: Run flake8 (linting) + run: | + poetry run flake8 . From 1bb3ccf9f945fbd5d0f2418888494975d1e2baed Mon Sep 17 00:00:00 2001 From: nikilok Date: Wed, 9 Jul 2025 12:44:57 +0100 Subject: [PATCH 2/3] manually induce a formatting error to see if the runner fails --- app/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 7299a37..31fa07f 100644 --- a/app/main.py +++ b/app/main.py @@ -14,9 +14,7 @@ @app.get("/search", response_model=List[CompanySearchResult]) @lessthan_x( - 3, - arg_name="company_name", - message="company_name must be at least 3 characters long.", + 3,arg_name="company_name",message="company_name must be at least 3 characters long.", ) def search_company( company_name: str = Query(..., description="Company name to search for") From 95ccde50b8278c62b4332b12b67d68b42b1a3a8c Mon Sep 17 00:00:00 2001 From: nikilok Date: Wed, 9 Jul 2025 12:54:17 +0100 Subject: [PATCH 3/3] fix the linting issue --- app/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 31fa07f..7299a37 100644 --- a/app/main.py +++ b/app/main.py @@ -14,7 +14,9 @@ @app.get("/search", response_model=List[CompanySearchResult]) @lessthan_x( - 3,arg_name="company_name",message="company_name must be at least 3 characters long.", + 3, + arg_name="company_name", + message="company_name must be at least 3 characters long.", ) def search_company( company_name: str = Query(..., description="Company name to search for")