Skip to content

Commit 8a63206

Browse files
jason810496Copilot
andauthored
Add CST-based script to complete missing async methods (#36)
* Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <[email protected]> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <[email protected]> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jason810496 <[email protected]> Co-authored-by: LIU ZHE YOU <[email protected]> * Add script to generate missing async methods for PGMQOperation (#37) * Initial plan * Add compelete_missing_async_methods_for_operation.py script and operation_ast helper Co-authored-by: jason810496 <[email protected]> * Fix path resolution bug in operation_ast.py Co-authored-by: jason810496 <[email protected]> * Address code review feedback: improve docstring handling and remove unnecessary method Co-authored-by: jason810496 <[email protected]> * Improve docstring handling robustness with better length checks Co-authored-by: jason810496 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jason810496 <[email protected]> * Fix queue await error * Add script to generate missing async tests for PGMQOperation using CST (#39) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <[email protected]> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <[email protected]> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jason810496 <[email protected]> Co-authored-by: LIU ZHE YOU <[email protected]> * Initial plan * Add compelete_missing_test_for_operation.py script with CST-based approach Co-authored-by: jason810496 <[email protected]> * Fix code review feedback: remove redundant code and use Tuple from typing Co-authored-by: jason810496 <[email protected]> * Finalize test_operation * Fix _check_pg_partman_ext naming --------- Co-authored-by: LIU ZHE YOU <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: jason810496 <[email protected]> * Add script to generate missing async tests using CST transformations (#38) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <[email protected]> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <[email protected]> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jason810496 <[email protected]> Co-authored-by: LIU ZHE YOU <[email protected]> * Initial plan * Add complete_missing_test_for_queue.py script with CST-based approach Co-authored-by: jason810496 <[email protected]> * Apply ruff formatting to test generation scripts Co-authored-by: jason810496 <[email protected]> * Address code review feedback: fix path resolution, type hints, and documentation Co-authored-by: jason810496 <[email protected]> * Fix missing async replacment for compelete test queue * Fix imports for async fixtures --------- Co-authored-by: LIU ZHE YOU <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: jason810496 <[email protected]> * Unifing script name for queue * Add missing async test methods for queue, fix check_pg_partman_ext --------- Co-authored-by: Copilot <[email protected]>
1 parent f373b79 commit 8a63206

26 files changed

Lines changed: 4649 additions & 77 deletions

.pre-commit-config.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,16 @@ repos:
77
- id: ruff
88
args: [ --fix ]
99
# Run the formatter.
10-
- id: ruff-format
10+
- id: ruff-format
11+
- repo: local
12+
hooks:
13+
- id: check-sync-async-method-for-queue
14+
name: Check sync/async method for queue
15+
entry: ./scripts/ci/pre_commit/check_sync_async_method_for_queue.py
16+
files: ^pgmq_sqlalchemy/.*\.py$
17+
language: python
18+
- id: check-sync-async-method-for-operation
19+
name: Check sync/async method for operation
20+
entry: ./scripts/ci/pre_commit/check_sync_async_method_for_operation.py
21+
files: ^pgmq_sqlalchemy/.*\.py$
22+
language: python

0 commit comments

Comments
 (0)