Skip to content

Conversation

@maxulysse
Copy link
Member

@maxulysse maxulysse commented Oct 20, 2025

  • Improve softwareVersionsToYaml():
    • add the Nextflow version as as input since I never managed to get it from the session in the plugin
    • have the function to deal with channel topics and versions.yml file

Initial PR split into:

@edmundmiller
Copy link
Contributor

Can we split these into two PRs? 😬

@maxulysse maxulysse changed the title add getGenomeAttribute() and improve softwareVersionsToYAML() improve softwareVersionsToYAML() Oct 22, 2025
@maxulysse
Copy link
Member Author

maxulysse commented Oct 22, 2025

Can we split these into two PRs? 😬

Done, and even better, made 3 +1 in the end

Copy link

@nvnieuwk nvnieuwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! can this also be documented?

@nvnieuwk
Copy link

Also, can you create some tests?

edmundmiller

This comment was marked as duplicate.

edmundmiller

This comment was marked as duplicate.

edmundmiller

This comment was marked as duplicate.

edmundmiller

This comment was marked as duplicate.

* docs: fix typo in softwareVersionsToYAML documentation

Fix typo in JavaDoc example code where 'versions_yamllet'' was
incorrectly written instead of 'versions_yaml'.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: simplify softwareVersionsToYAML with focused helper methods

Refactored the complex 166-line softwareVersionsToYAML() method by
extracting only essential helper methods that provide real value:

Core improvements:
- Main method now ~100 lines with visible, straightforward logic
- Extracted 4 focused helper methods (down from original over-engineered 13):
  * processYamlContent(): Eliminates duplicate YAML parsing (used 5+ times)
  * mergeParsedYaml(): Handles complex nested/flat YAML detection logic
  * mergeProcessMap(): Reusable process map merging with key cleaning
  * hasToFileMethod(): Safety-critical reflection for Path detection

- Type routing, simple string operations, and sorting kept inline
- Uses small recursive closure for nested list handling
- Eliminates deeply nested closures from original implementation

Benefits:
- Better balance between simplicity and maintainability
- Main logic flow visible and easy to follow
- Real complexity extracted to testable helpers
- No thin wrapper methods adding unnecessary indirection
- All tests pass without modification

This approach keeps both Nextflow usage AND the code simple while
improving on the original deeply-nested 166-line implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
@maxulysse maxulysse merged commit 25afc84 into main Oct 29, 2025
3 checks passed
@maxulysse maxulysse deleted the topics_migration_helper branch October 29, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants