Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .claude/commands/pre-commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Pre-commit checklist

Before running the checklist, run `git fetch origin`. If the current branch is behind `origin/master`, stop and rebase before proceeding.

Run the pre-commit checklist for this project:

1. Update `CHANGELOG.md` `[Unreleased]` section — add an entry under the
appropriate subsection (Added / Changed / Fixed / Removed) describing the
changes made, referencing the issue number.
2. Run `uv run flake8 .` — must pass.
3. Run `uv run black --check .` — must pass (run `uv run black .` to auto-fix).
4. Run `uv run pytest --cov=./ --cov-report=term --cov-fail-under=80` — all tests must pass, coverage must be ≥80%.
5. If Docker is running, run `docker compose build` — must succeed with no
errors. Skip this step with a note if Docker Desktop is not running.
6. If `coderabbit` CLI is installed, run `coderabbit review --type uncommitted --prompt-only`:
- If actionable/serious findings are reported, stop and address them before proposing the commit.
- If only nitpick-level findings, report them and continue to the commit proposal.
- If `coderabbit` is not installed, skip this step with a note.

Run steps 1–5, report the results clearly, then run step 6 (CodeRabbit review) if available, then propose a branch name and commit message for my approval using the format `type(scope): description (#issue)` (max 80 chars; types: `feat` `fix` `chore` `docs` `test` `refactor` `ci` `perf`). Do not create the branch or commit until I explicitly confirm.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ open PRs, or create tags until I explicitly confirm.
- **Next codename**: next letter in the A–Z sequence after the current one.
Use lowercase with no spaces for the tag (e.g. `eriksson`);
Title Case for the CHANGELOG heading (e.g. `Eriksson`).
If no tags exist yet, start at `A` (first coach in the table).
If letters were skipped, pick the next after the highest existing
codename — do not backfill gaps.
If the last codename is `Z` (Zeman), the list is finite — stop and
flag that the naming convention needs to be revisited.
- **Version bump** — infer from `[Unreleased]`:

| Condition | Bump |
|---|---|
| Any entry marked BREAKING | MAJOR |
| Any entry marked BREAKING (case-insensitive), `BREAKING CHANGE:` token in a commit footer, or `!` suffix after type/scope (e.g. `feat!:`) | MAJOR |
| Entries under Added | MINOR |
| Only Changed / Fixed / Removed | PATCH |

Expand Down Expand Up @@ -63,17 +68,16 @@ open PRs, or create tags until I explicitly confirm.

5. **Propose commit**: `docs(changelog): release vX.Y.Z Codename`

6. **After confirmation**: commit. Then run steps 2–4 of `/precommit` (linting,
formatting, tests — the CHANGELOG step is already handled). Push the branch
and open a PR into `master` only once all checks pass.
6. **After confirmation**: commit. Then run steps 2–5 of `/pre-commit` (linting,
formatting, tests, CodeRabbit review — the CHANGELOG step is already handled).
Push the branch and open a PR into `master` only once all checks pass.

---

## Phase 3 — Tag and release

7. **Stop and wait** for confirmation that:
- All CI checks have passed
- CodeRabbit review comments have been addressed
- The PR has been merged into `master`

8. **Pull `master`**, then propose the annotated tag:
Expand Down
12 changes: 0 additions & 12 deletions .claude/commands/precommit.md

This file was deleted.

5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@
.vscode/
htmlcov/
postman-collections/
.claude/
CLAUDE.md
.codacy.yml
.coderabbit.yaml
.coverage
.coveragerc
.flake8
.gitignore
.pylintrc
CHANGELOG.md
CODE_OF_CONDUCT.md
codecov.yml
commitlint.config.mjs
CONTRIBUTING.md
coverage.xml
LICENSE
.sonarcloud.properties
/tests/
__pycache__/
*.pyc
Expand Down
58 changes: 58 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# =============================================================================
# SonarCloud Automatic Analysis configuration
# https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/automatic-analysis/
#
# SonarCloud's automatic analysis (GitHub App, no CI workflow) reads THIS file.
# Wildcard patterns are NOT supported here, so all exclusion paths must be
# listed explicitly.
# =============================================================================

sonar.projectKey=nanotaboada_python-samples-fastapi-restful
sonar.organization=nanotaboada
sonar.projectName=python-samples-fastapi-restful

sonar.sources=databases,models,routes,schemas,services,tools,main.py
sonar.tests=tests

# =============================================================================
# Global exclusions
# Standalone seed scripts excluded from analysis.
# =============================================================================

sonar.exclusions=\
tools/seed_001_starting_eleven.py,\
tools/seed_002_substitutes.py

# =============================================================================
# Coverage exclusions
# Mirrors codecov.yml ignore list — focus on routes/, services/
# =============================================================================

sonar.coverage.exclusions=\
databases/__init__.py,\
databases/player_database.py,\
models/__init__.py,\
models/player_model.py,\
schemas/__init__.py,\
schemas/player_schema.py,\
tools/seed_001_starting_eleven.py,\
tools/seed_002_substitutes.py,\
tests/__init__.py,\
tests/conftest.py,\
tests/player_stub.py,\
tests/test_main.py,\
main.py

# =============================================================================
# Duplicate code (CPD) exclusions
# Automatic analysis does not support wildcard patterns, so each file is
# listed explicitly.
#
# player_stub.py — test fixture; parallel field assignments by design.
# seed scripts — sequential insert calls are intentionally repetitive.
# =============================================================================

sonar.cpd.exclusions=\
tests/player_stub.py,\
tools/seed_001_starting_eleven.py,\
tools/seed_002_substitutes.py
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ This project uses famous football coaches as release codenames, following an A-Z

### Added

- `.sonarcloud.properties`: SonarCloud Automatic Analysis configuration —
sources, tests, coverage exclusions aligned with `codecov.yml` (#554)
- `.dockerignore`: added `.claude/`, `CLAUDE.md`, `.coderabbit.yaml`,
`.sonarcloud.properties`, `CHANGELOG.md`, `README.md` (#554)
- CD workflow now verifies tag commit is reachable from `master` before
proceeding with build and publish steps (#549)

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

## Claude Code

- Run `/precommit` to execute the full pre-commit checklist for this project.
- Run `/pre-commit` to execute the full pre-commit checklist for this project.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-3DA639.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![Dependabot](https://img.shields.io/badge/Dependabot-contributing-025E8C?logo=dependabot&logoColor=white&labelColor=181818)
![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-contributing-8662C5?logo=githubcopilot&logoColor=white&labelColor=181818)
![Claude](https://img.shields.io/badge/Claude-Sonnet_4.6-D97757?logo=claude&logoColor=white&labelColor=181818)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/nanotaboada/python-samples-fastapi-restful?utm_source=oss&utm_medium=github&utm_campaign=nanotaboada%2Fpython-samples-fastapi-restful&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews&labelColor=181818)
![Copilot](https://img.shields.io/badge/Copilot-contributing-8662C5?logo=githubcopilot&logoColor=white&labelColor=181818)
![Claude](https://img.shields.io/badge/Claude-contributing-D97757?logo=claude&logoColor=white&labelColor=181818)
![CodeRabbit](https://img.shields.io/badge/CodeRabbit-reviewing-FF570A?logo=coderabbit&logoColor=white&labelColor=181818)

Proof of Concept for a RESTful API built with [Python 3](https://www.python.org/) and [FastAPI](https://fastapi.tiangolo.com/). Manage football player data with SQLite, SQLAlchemy 2.0 (async), Pydantic validation, and in-memory caching.

Expand Down
Loading