[project] name = "testsandmisc" version = "0.1.0" description = "Collection of miscellaneous tests and scripts" requires-python = ">=3.10" # ============================================================================ # RUFF - Extremely fast Python linter and formatter (written in Rust) # ============================================================================ [tool.ruff] target-version = "py310" # Include all Python files include = ["*.py", "**/*.py"] # Exclude vendored/build directories exclude = [ ".git", ".venv", "__pycache__", "build", "dist", ".eggs", "Bash/ffmpeg-build", # Vendored FFmpeg tools ] [tool.ruff.lint] # AGGRESSIVE: Select ALL rules from all categories select = ["ALL"] # Ignores for rules that are too strict for this mixed script repository ignore = [ # D203 vs D211 conflict - we use D211 (no blank line before class docstring) "D203", # 1 blank line required before class docstring (conflicts with D211) # D212 vs D213 conflict - we use D212 (summary on first line after """) "D213", # Multi-line docstring summary should start at second line (conflicts with D212) # Formatter conflicts - recommended to disable when using ruff format # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "COM812", # Trailing comma missing - formatter handles this automatically "ISC001", # Implicit string concatenation - formatter may create these when wrapping # Security audit - prone to false positives with validated input # https://github.com/astral-sh/ruff/issues/4045 "S603", # subprocess call without shell - prone to false positives as it is # difficult to determine whether the passed arguments have been validated ] # Allow ALL rules to be auto-fixed fixable = ["ALL"] unfixable = [] # Per-file ignores [tool.ruff.lint.per-file-ignores] # Test files - allow test-specific patterns (assert, magic values) "**/tests/**/*.py" = [ "S101", # Allow assert in tests "PLR2004", # Allow magic values in tests ] "**/test_*.py" = [ "S101", # Allow assert in tests "S310", # Allow URL open in tests "S607", # Allow partial executable path in tests "PLC0415", # Allow late imports for test isolation "PLR2004", # Allow magic values in tests ] "poker_modifier_app/poker_modifier_app.py" = [ "FBT003", # Boolean positional values in tkinter API calls ] "python_pkg/keyboard_coop/main.py" = [ "FBT003", # Boolean positional values in pygame API calls (e.g., font.render) ] "python_pkg/screen_locker/screen_lock.py" = [ "FBT003", # Boolean positional values in tkinter API calls ] [tool.ruff.lint.pydocstyle] convention = "google" # Use Google docstring convention [tool.ruff.lint.isort] force-single-line = false force-sort-within-sections = true known-first-party = ["python_pkg"] [tool.ruff.lint.flake8-quotes] docstring-quotes = "double" inline-quotes = "double" [tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" [tool.ruff.format] quote-style = "double" indent-style = "space" skip-magic-trailing-comma = false line-ending = "auto" docstring-code-format = true # ============================================================================ # MYPY - Static type checker (most aggressive settings) # ============================================================================ [tool.mypy] python_version = "3.10" # Strict mode enables most checks strict = true # Additional aggressive settings warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true disallow_incomplete_defs = true check_untyped_defs = true disallow_untyped_decorators = true no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true warn_no_return = true warn_unreachable = true # Extra strict settings disallow_any_unimported = true disallow_any_explicit = false # Too aggressive for practical use disallow_any_generics = true disallow_subclassing_any = true strict_equality = true extra_checks = true # Allow missing imports for third-party packages ignore_missing_imports = true # Show error codes show_error_codes = true # Enable colored output color_output = true # Exclude vendored directories exclude = [ "Bash/ffmpeg-build/", ".venv/", ] # ============================================================================ # PYLINT - Comprehensive Python linter # ============================================================================ [tool.pylint.main] # Analyse import fallback blocks analyse-fallback-blocks = true # Pickle collected data for later comparisons persistent = true # Jobs to use for parallel execution (0 = auto) jobs = 0 # Minimum Python version py-version = "3.10" # Ignore vendored directories ignore = ["Bash", ".venv", "__pycache__"] # Ignore patterns ignore-patterns = [".*\\.pyi$"] # Allow C extension modules to be introspected extension-pkg-allow-list = ["cv2", "pygame", "lxml"] [tool.pylint.messages_control] # Enable all checks by disabling disable enable = "all" # No disabled checks - maximum strictness disable = [] [tool.pylint.design] # A class with just run() as public API is valid for games/apps min-public-methods = 1 [tool.pylint.spelling] # No spelling dictionary to avoid false positives spelling-dict = "" [tool.pylint.typecheck] # cv2 (OpenCV) dynamically loads members from C extension at runtime generated-members = ["cv2.*"] # ============================================================================ # BANDIT - Security linter # ============================================================================ [tool.bandit] # Exclude test directories and vendored code exclude_dirs = ["tests", ".venv", "Bash/ffmpeg-build", "python_pkg/lichess_bot/.venv"] # ============================================================================ # BLACK & ISORT - Removed (ruff handles formatting and import sorting) # ============================================================================ # ============================================================================ # PYTEST - Testing framework configuration # ============================================================================ [tool.pytest.ini_options] testpaths = ["tests", "PYTHON", "articles"] python_files = ["test_*.py", "*_test.py"] python_classes = ["Test*"] python_functions = ["test_*"] addopts = [ "-v", "--strict-markers", "--strict-config", "-ra", ] filterwarnings = [ "error", "ignore::DeprecationWarning", ] # ============================================================================ # COVERAGE - Code coverage configuration # ============================================================================ [tool.coverage.run] source = ["PYTHON", "articles", "poker-modifier-app"] branch = true omit = [ "*/__pycache__/*", "*/tests/*", "*/.venv/*", "Bash/*", ] [tool.coverage.report] # Fail under this percentage fail_under = 0 show_missing = true skip_covered = false exclude_lines = [ "pragma: no cover", "def __repr__", "raise AssertionError", "raise NotImplementedError", "if __name__ == .__main__.:", "if TYPE_CHECKING:", ] # ============================================================================ # VULTURE - Dead code detection # ============================================================================ # Note: Vulture uses command-line args, but we can document settings here # vulture --min-confidence 80 --exclude ".venv,Bash" . # ============================================================================ # PYDOCSTYLE - Docstring style checker (ruff handles this, but for standalone) # ============================================================================ # Configured in ruff.lint.pydocstyle above