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
8 changes: 8 additions & 0 deletions .claude/commands/precommit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Run the pre-commit checklist for this project:

1. Remind me to update `CHANGELOG.md` `[Unreleased]` section (Added / Changed / Fixed / Removed) — I must do this manually.
2. Run `uv run flake8 .` — must pass.
3. Run `uv run black --check .` — must pass (run `uv run black .` to auto-fix).
Comment on lines +4 to +5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the directories excluded by Black but not by flake8 exist
echo "Checking for directories excluded by Black but not flake8:"
for dir in rest scripts tools storage; do
  if [ -d "$dir" ]; then
    echo "  $dir/ exists - may cause linter inconsistency"
  else
    echo "  $dir/ does not exist"
  fi
done

Repository: nanotaboada/python-samples-fastapi-restful

Length of output: 343


🏁 Script executed:

#!/bin/bash
# Check the actual .flake8 configuration
echo "=== .flake8 configuration ==="
if [ -f ".flake8" ]; then
  cat ".flake8"
else
  echo ".flake8 file not found"
fi

echo ""
echo "=== pyproject.toml Black configuration ==="
if [ -f "pyproject.toml" ]; then
  grep -A 10 "\[tool.black\]" pyproject.toml
else
  echo "pyproject.toml file not found"
fi

Repository: nanotaboada/python-samples-fastapi-restful

Length of output: 536


🏁 Script executed:

#!/bin/bash
# Get the full Black configuration section
echo "=== Full pyproject.toml [tool.black] section ==="
if [ -f "pyproject.toml" ]; then
  sed -n '/\[tool.black\]/,/^\[/p' pyproject.toml | head -n -1
else
  echo "pyproject.toml file not found"
fi

Repository: nanotaboada/python-samples-fastapi-restful

Length of output: 403


Fix linter exclusion inconsistency between flake8 and Black.

The .flake8 configuration only excludes .venv, while pyproject.toml configures Black to exclude rest/, scripts/, tools/, storage/, and tests/test_main.py. This creates a mismatch: flake8 will check files that Black intentionally skips, potentially causing spurious failures in the pre-commit checklist.

Additionally, tests/test_main.py is treated inconsistently—Black excludes it entirely, but flake8 checks it (ignoring only E501 via per-file-ignores). Align .flake8 exclusions with Black's configuration to ensure consistent linting behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/precommit.md around lines 4 - 5, Update the flake8
exclusions to match Black's excludes so both linters operate on the same file
set: modify the .flake8 configuration (the Exclude setting) to include the same
patterns used by Black in pyproject.toml (rest/, scripts/, tools/, storage/) and
explicitly exclude tests/test_main.py (or add a consistent per-file-ignores
entry) so flake8 no longer checks files Black skips; ensure you edit the .flake8
Exclude and any per-file-ignores to align with the pyproject.toml Black exclude
entries.

4. Run `uv run pytest --cov=./ --cov-report=term` — all tests must pass, coverage must be ≥80%.

Run steps 2–4, report the results clearly, 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.
5 changes: 1 addition & 4 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"model": "claude-sonnet-4-6",
"permissions": {
"allow": [
"Bash(gh issue:*)",
"Bash(gh auth:*)",
"Bash(uv run:*)",
"Bash(uv run *)",
"Bash(source .venv/bin/activate)",
"WebFetch(domain:github.com)",
"WebFetch(domain:api.github.com)"
Expand Down
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ms-python.python", // Python language support

// AI Assistance
"github.copilot-chat", // GitHub Copilot Chat - AI-powered coding assistant
"anthropic.claude-code", // Claude Code - AI-powered coding assistant
"coderabbit.coderabbit-vscode", // CodeRabbit - AI-powered code review

// Code Quality
Expand Down Expand Up @@ -46,6 +46,6 @@
"unwantedRecommendations": [
"ms-azuretools.vscode-docker", // Docker (legacy) - Use vscode-containers instead
"docker.docker", // Docker DX - Use ms-azuretools.vscode-containers
"github.copilot" // Copilot (base) - Unified into copilot-chat
"github.copilot" // GitHub Copilot - legacy base extension
]
}
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# CLAUDE.md

@.github/copilot-instructions.md

## Claude Code

- Run `/precommit` to execute the full pre-commit checklist for this project.
Loading