From 6d2b1ab4ab27ec2f7d9db7bfc93f61aa87e6e70d Mon Sep 17 00:00:00 2001 From: Nitzan Pomerantz <9297302+nitzpo@users.noreply.github.com> Date: Fri, 31 Oct 2025 19:02:21 +0200 Subject: [PATCH] Update code quality for vscode --- .vscode/extensions.json | 6 ++++++ .vscode/launch.json | 22 ++++++++++++++++++++++ .vscode/settings.json | 41 +++++++++++++++++++++++++++++++++++++++++ check-quality.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100755 check-quality.sh diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ccc5123 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "charliermarsh.ruff", + "ms-python.python" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..99a0428 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Python Debugger: pytest", + "type": "debugpy", + "request": "launch", + "module": "pytest", + "args": [ + "${workspaceFolder}/tests", + "-v", + // "-k test_filter_by_property_type_partial_match" + ], + "console": "integratedTerminal", + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..12a459e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,41 @@ +{ + // Ruff integration for automatic code quality + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + }, + "editor.defaultFormatter": "charliermarsh.ruff" + }, + + // Ruff configuration + "ruff.enable": true, + "ruff.organizeImports": true, + "ruff.fixAll": true, + + // Show lint errors inline + "python.linting.enabled": true, + "python.linting.ruffEnabled": true, + + // Test configuration + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false, + "python.testing.pytestArgs": [ + "tests", + "-m", + "not api_health" + ], + + // Exclude common directories + "files.exclude": { + "**/__pycache__": true, + "**/*.pyc": true, + "**/.pytest_cache": true, + "**/.ruff_cache": true + }, + + // Auto-save + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 1000 +} diff --git a/check-quality.sh b/check-quality.sh new file mode 100755 index 0000000..0b34e2f --- /dev/null +++ b/check-quality.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Quick code quality check script +# Run this before committing to catch issues early + +set -e + +echo "🔍 Running code quality checks..." +echo "" + +# Activate virtualenv if it exists +if [ -d "venv" ]; then + source venv/bin/activate +fi + +echo "1️⃣ Checking code formatting with Ruff..." +ruff format --check . +echo "✅ Formatting check passed" +echo "" + +echo "2️⃣ Running Ruff linter..." +ruff check . +echo "✅ Linting passed" +echo "" + +echo "3️⃣ Running tests..." +pytest tests/ -m "not api_health" -q +echo "✅ Tests passed" +echo "" + +echo "🎉 All checks passed! Ready to commit."