feat: introduce ruff for linting and code quality
This commit migrates the project from pylint/pycodestyle to ruff for linting, establishing a modern Python development standard with automated code quality checks. - Created pyproject.toml with comprehensive ruff configuration: - Line length: 100 characters - Target Python: 3.8+ - Enabled rules: E, W, F, I (isort), C4, B, UP - Configured isort to recognize Adyen as first-party module - Added dev dependencies for ruff and pre-commit - Created .pre-commit-config.yaml: - Set up ruff-lint hook with auto-fix enabled - Set up ruff-format hook for code formatting - Updated Makefile: - Replaced pylint/pycodestyle with ruff in install target - Added 'lint' target: ruff check Adyen test - Added 'lint-fix' target: ruff check --fix Adyen test - Added 'format' target: ruff format Adyen test - Updated tox.ini: - Added 'lint' environment for CI linting checks - Configured lint environment to run ruff checks - Updated setup.py: - Added 'dev' extras with ruff and pre-commit dependencies - Fixed 301 linting issues (reduced from 301 to 0): * 111 f-string without placeholders (F541) - Removed extraneous f prefixes * 102 super() call with parameters (UP008) - Updated to modern super() syntax * 30 unsorted imports (I001) - Sorted imports correctly * 26 unused imports (F401) - Added explicit re-exports for public API * 11 unused variables (F841) - Added proper response assertions to tests * 4 printf-style formatting (UP031) - Converted to f-strings * Other minor issues: blank lines, future imports, mock imports, trailing whitespace - Enhanced tests with proper response assertions: - DisputesTest: Verify disputeServiceResult and defenseReasons structure - StoredValueTest: Assert resultCode == 'Success' and pspReference - TransfersTest: Verify transfer response fields and status - UtilTest: Assert paymentMethods structure and content - Unified linting toolchain with ruff - Faster linting (ruff is 10-100x faster than pylint) - Better code consistency across the project - Pre-commit hooks for automatic quality checks before commits - Comprehensive test coverage with response validation - Modern Python practices (f-strings, updated syntax) 1. Install dev dependencies: pip install -e '.[dev]' 2. Install pre-commit hooks: pre-commit install 3. Run linting: make lint 4. Fix linting issues: make lint-fix 5. Format code: make format 6. Run tests: make tests or tox ci: add github actions workflow for linting - Added lint job to run ruff check and ruff format on Python 3.8-3.12 - Added pre-commit job using pre-commit/action - Runs on push to main/develop and on pull requests - Includes pip caching to speed up workflow execution ci: expand python version matrix to 3.8-3.14 - Updated lint job to test all supported Python versions - Matches tox.ini and setup.py configuration - Now covers Python 3.13 and 3.14 style: apply ruff formatting to all source files - Formatted 116 files with ruff formatter - Ensures consistent code style across the project - Fixes CI formatting check failures
T
thomasc-adyen committed
ea72a2cfc718c60c55c81fbe1f1baa43c2d46bd0
Parent: 12c0572