/
yesgenius
/
q-reply
Обзор
Документация
Войти
/
yesgenius
/
q-reply
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
pyproject.toml
215 строк
10 KB
yesgenius
Changes to be committed:
16 сен 2025, 11:36
16 сен 2025, 11:36
3fbc9d0
Код
Авторство
О чём код?
# ════════════════════════════════════════════════════════════════════════════════════ # RUFF # ════════════════════════════════════════════════════════════════════════════════════ [tool.ruff] target-version = "py312" # Python version to target for compatibility checks line-length = 100 # Maximum line length before triggering E501 src = ["calorie_balance_bot"] # Source code directories for import resolution fix = true # Automatically fix safe violations exclude = [ ".git", ".venv", "__pycache__", ".mypy_cache", ".pytest_cache", ".ruff_cache", "dist", "build", "*.egg-info", ".dockerignore", "Dockerfile", "docker-compose*.yml", "migrations", "alembic" ] [tool.ruff.lint] select = [ "E", "W", # pycodestyle errors and warnings "F", # pyflakes "I", # isort "N", # pep8-naming "UP", # pyupgrade "B", # flake8-bugbear "C4", # flake8-comprehensions "SIM", # flake8-simplify "TCH", # flake8-type-checking "ARG", # flake8-unused-arguments "PTH", # flake8-use-pathlib "RUF", # ruff-specific rules "S", # flake8-bandit (security) "ASYNC", # flake8-async "D", # pydocstyle "PT", # flake8-pytest-style "PERF", # perflint "RET", # flake8-return "SLF", # flake8-self "SLOT", # flake8-slots "TRY", # tryceratops "FLY", # flynt "PIE", # flake8-pie "PL", # pylint "DTZ", # flake8-datetimez "G", # flake8-logging-format "T20", # flake8-print "ANN", # flake8-annotations ] ignore = [ "D100", "D104", "D107", "D203", "D213", # pydocstyle conflicts "ANN101", "ANN102", # self/cls annotations are redundant "E501", # line too long (handled by formatter) "B008", # function calls in argument defaults "S101", # use of assert "PLR0913", # too many arguments "TRY003", # long messages in exceptions "RUF001", "RUF002", "RUF003", # unicode issues ] fixable = ["ALL"] # Rules that can be auto-fixed unfixable = ["F841", "F401"] # Rules requiring manual review [tool.ruff.lint.per-file-ignores] "tests/**" = ["S101", "D", "ARG", "PLR2004", "S106", "S311", "ANN"] "migrations/**" = ["D", "S", "DTZ"] "**/bootstrap/*.py" = ["T201"] # Allow print in bootstrap "**/__init__.py" = ["F401", "D104"] # Allow star imports in __init__ [tool.ruff.lint.isort] known-first-party = ["calorie_balance_bot"] combine-as-imports = true # Combine multiple imports from same module force-sort-within-sections = true # Sort imports alphabetically within sections force-wrap-aliases = true # Wrap long imports with parentheses lines-after-imports = 2 # Blank lines after import section required-imports = ["from __future__ import annotations"] # Future annotations for better typing [tool.ruff.lint.pydocstyle] convention = "google" # Docstring style convention [tool.ruff.lint.mccabe] max-complexity = 10 # Maximum cyclomatic complexity [tool.ruff.lint.pylint] max-args = 7 # Maximum function arguments max-branches = 12 # Maximum branches in function max-returns = 5 # Maximum return statements max-statements = 40 # Maximum statements in function body [tool.ruff.format] quote-style = "double" # Use double quotes for strings indent-style = "space" # Use spaces for indentation skip-magic-trailing-comma = false # Keep trailing commas line-ending = "lf" # Unix-style line endings docstring-code-format = true # Format code in docstrings # ════════════════════════════════════════════════════════════════════════════════════ # MYPY # ════════════════════════════════════════════════════════════════════════════════════ [tool.mypy] python_version = "3.12" # Python version for type checking files = ["calorie_balance_bot"] # Files to type check strict = true # Enable all strict type checking flags pretty = true # Format error messages for readability show_error_context = true # Show code context in errors show_column_numbers = true # Display column numbers in errors show_error_codes = true # Include error codes in messages color_output = true # Enable colored output warn_return_any = true # Warn about functions returning Any warn_unused_configs = true # Warn about unused type: ignore comments warn_unused_ignores = false # Don't warn about unused ignores (pragmatic) warn_redundant_casts = true # Warn about unnecessary casts warn_unreachable = true # Warn about unreachable code no_implicit_optional = true # Require Optional for None default values no_implicit_reexport = true # Require explicit re-exports disallow_untyped_decorators = true # All decorators must be typed disallow_any_generics = true # Disallow Any in generic types check_untyped_defs = true # Check untyped function definitions strict_equality = true # Use strict equality checks namespace_packages = true # Support namespace packages explicit_package_bases = true # Use explicit base paths for imports warn_no_return = true # Warn about missing return statements enable_error_code = [ "truthy-bool", "redundant-expr", "possibly-undefined", ] plugins = [ "pydantic.mypy", "sqlalchemy.ext.mypy.plugin" ] exclude = [ "^\\.venv", "^venv", "^\\.git", "^\\.mypy_cache", "^\\.pytest_cache", "^\\.ruff_cache", "^dist", "^build", "^migrations", "^alembic" ] [tool.pydantic-mypy] init_forbid_extra = true # Forbid extra attributes in models init_typed = true # Require typed __init__ methods warn_required_dynamic_aliases = true # Warn about dynamic aliases [[tool.mypy.overrides]] module = [ "aiogram.*", "asyncpg.*", "alembic.*", "dependency_injector.*", "tenacity.*" ] ignore_missing_imports = true # Ignore missing type stubs for third-party packages [[tool.mypy.overrides]] module = "tests.*" disallow_untyped_defs = false # Relax typing in tests disallow_untyped_decorators = false # Allow untyped decorators in tests allow_redefinition = true # Allow variable redefinition in tests # ════════════════════════════════════════════════════════════════════════════════════ # PYTEST # ════════════════════════════════════════════════════════════════════════════════════ [tool.pytest.ini_options] minversion = "8.0" # Minimum pytest version required asyncio_mode = "auto" # Auto-detect async tests and fixtures asyncio_default_fixture_loop_scope = "function" # Event loop scope for fixtures addopts = [ "--strict-markers", # Unknown markers are errors "--strict-config", # Invalid config is an error "--tb=short", # Shorter traceback format "--cov=calorie_balance_bot", # Measure coverage for package "--cov-report=term-missing:skip-covered", # Show missing lines "--cov-report=html:htmlcov", # Generate HTML report "--cov-fail-under=80" # Fail if coverage < 80% ] testpaths = ["tests"] # Directories containing tests pythonpath = ["."] # Add to Python path for imports filterwarnings = [ "error::DeprecationWarning", "error::PendingDeprecationWarning" ] markers = [ "slow: marks tests as slow (deselect with '-m \"not slow\"')", "integration: marks tests as integration tests", "unit: marks tests as unit tests", "smoke: marks tests as smoke tests" ] # ──────────────────────────────────────────────────────────────────────────────────── # COVERAGE # ──────────────────────────────────────────────────────────────────────────────────── [tool.coverage.run] source = ["calorie_balance_bot"] # Source code to measure branch = true # Measure branch coverage parallel = true # Support parallel test execution omit = ["*/tests/*", "*/migrations/*", "*/__init__.py", "*/config.py"] [tool.coverage.report] precision = 2 # Decimal precision for percentages show_missing = true # Show lines not covered skip_covered = false # Don't hide files with 100% coverage exclude_lines = [ "pragma: no cover", # Explicit exclusion marker "def __repr__", # String representations "def __str__", # String conversions "if TYPE_CHECKING:", # Type checking blocks "if typing.TYPE_CHECKING:", "raise AssertionError", # Assertions "raise NotImplementedError", # Abstract methods "if __name__ == .__main__.:", # Script entry points "@abstractmethod", # Abstract method decorators "@abc.abstractmethod", "@overload", # Type overloads "pass", # Pass statements "\\.\\.\\." # Ellipsis ] [tool.coverage.html] directory = "htmlcov" # Output directory for HTML reports [tool.coverage.xml] output = "coverage.xml" # Output file for XML reports (CI/CD)