-
Notifications
You must be signed in to change notification settings - Fork 214
feat: Add Claude Code hooks for automated testing and linting #3774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Tools like picard, fgbio, and samtools all have sub-commands. It is onerous to have to update them all individually using nf-core modules bump-version. This change allows the module name to update to have a trailing forward slash, which will be interpreted as specifying that all subcommands should be updated. E.g. nf-core modules bump-version samtools/
…s-for-sub-modules
…dling - Renamed test functions for clarity. - Introduced DummyModule and DummyLint classes to simulate module and lint behavior. - Enhanced tests for handling invalid, empty, and missing dependencies in environment.yml files. - Improved assertions to validate sorting and schema compliance.
- Replaced yaml library with ruamel.yaml for improved YAML processing. - Added schema validation for environment.yml files. - Implemented sorting for dependencies and channels, ensuring proper order. - Updated file writing to include schema lines and sorted content. - Enhanced logging for sorting actions and validation results.
…processing - Updated the YAML library from ruamel.yaml to PyYAML for improved compatibility. - Changed YAML loading to use safe_load for better security. - Enhanced YAML dumping with specific formatting options for clarity. - Adjusted error handling to reflect the new library usage.
…ent.yml processing" This reverts commit 34d5b00. Co-authored-by: mashehu <mashehu@users.noreply.github.com>
…endencies Co-authored-by: mashehu <mashehu3@gmail.com>
…l sorting - Removed channel sorting logic from environment.yml processing. - Updated related tests to reflect channel preservation instead of sorting. - Adjusted logging messages to focus solely on dependency sorting. Co-authored-by: mashehu <mashehu3@gmail.com>
- Introduced factory fixtures for creating DummyModule and DummyLint instances to streamline test setup. - Updated tests to utilize the new setup_lint_environment fixture for improved clarity and maintainability. - Enhanced assertions for YAML parsing results in the environment.yml sorting tests. - Added parameterized tests for handling invalid and empty YAML files.
- Updated pytest.ini_options in pyproject.toml to include a new "integration" marker for better test categorization.
…nt_test attribute - Changed the assertion to check for the "environment_yml_sorted" in the lint.passed list using the lint_test attribute instead of the previous tuple structure.
but it is a link to another json file
Remove workflow.trace from nf-test snapshot
ignore files in gitignore also for pipeline_if_empty_null lint test
Add GHA to update template nf-test snapshots
- Replace assertions in setUp methods with skipTest() for proper error handling - Remove unnecessary setUp methods where only one test needs module installation - Eliminate manual test cleanup code relying on test framework isolation - Consolidate module installation in setUp where all tests in class need it - Update registry test to properly expect failures with mismatched registries Addresses code review feedback on test best practices and structure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Refactor module lint tests
Add new lint check `test_snap_version_content` to ensure version information in test snapshots contains actual content instead of MD5/SHA hash values. This addresses the issue where version snapshots were storing hash values like "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" instead of actual version content like {"ALE": {"ale": "20180904"}}. Changes: - Add version content validation in module_tests.py with regex patterns - Add comprehensive tests for both invalid (hash) and valid (content) cases - Add pytest issue marker support for linking tests to GitHub issues - Update pyproject.toml with new pytest marker configuration Fixes: nf-core/modules#6505 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…egex and error handling - Extract version checking logic into dedicated helper functions for better modularity - Implement more precise regex patterns with proper word boundaries to avoid false positives - Optimize performance by reducing string conversions from multiple to single per test - Add comprehensive test coverage for SHA hashes, mixed scenarios, and edge cases - Enhance error messages with clearer guidance and examples for developers - Improve code maintainability and readability through separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix critical indentation issue where version checking ran outside the test loop - Remove redundant _check_version_content_format function for cleaner logic - Ensure version content validation runs for each test individually - Improve regex patterns with word boundaries for more precise hash detection - Add comprehensive test coverage for SHA hashes, mixed scenarios, and edge cases - All new tests now pass correctly after fixing the loop structure Related to: nf-core/modules#6505 Fixed in: #3676 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This PR is against the
|
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Clean up AI-generated comments and verbose documentation - Improve version hash detection to handle both content and keys - Add test case for version hash in snapshot keys scenario - Update CHANGELOG.md with feature description - Preserve all existing pytest-workflow logic for separate PR Addresses feedback from @mashehu and @mirpedrol Related to: nf-core/modules#6505
7e90309
to
1ddf9ce
Compare
I can't change the base branch to |
Summary
uv run
Key Features
test_*.py
files are editednf_core/
, automatically finds and runs corresponding test filesruff
linting, formatting validation, andmypy
type checking on Python filesuv run
commands per project standardsTechnical Implementation
.claude/hooks/post-edit.py
- Python script that analyzes edited files and executes appropriate commands.claude/settings.local.json
with PostToolUse hooks for Edit/MultiEdit/Write toolsTest Plan
🤖 Generated with Claude Code