diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml new file mode 100644 index 0000000..e225282 --- /dev/null +++ b/.github/workflows/linting.yaml @@ -0,0 +1,23 @@ +# .github/workflows/linting.yaml +name: Code Quality + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install dependencies + run: | + pip install flake8 black isort + - name: Run Black (formatting check) + run: black --check . + - name: Run isort (import sorting check) + run: isort --check-only . + - name: Run Flake8 (linting) + run: flake8 . --max-line-length=100 --ignore=E501,W503 \ No newline at end of file diff --git a/app.py b/app.py index 2fc7751..3e5543f 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,7 @@ -from flask import Flask, render_template, request, jsonify import random +from flask import Flask, jsonify, render_template, request + app = Flask(__name__) @@ -96,7 +97,7 @@ def index(): @app.route("/move", methods=["POST"]) -def make_move(): +def move(): """ Handles player moves via POST requests. Receives the cell index from the request, makes the move, and returns the updated game state as JSON.