Skip to content
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

Move unpinned version check to an observer #91

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Version 2.4.0dev

## Bug fixes

1. Move the unpinned version check to an observer. This makes sure the warning is always shown and not only when importing a function.

## Changes

1. Refactored the whole codebase to make future development easier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,6 @@ class ValidationExtension extends PluginExtensionPoint {

@Override
protected void init(Session session) {
def plugins = session?.config?.navigate("plugins") as ArrayList
// TODO move the warning to an observer
if(plugins?.contains("nf-schema")) {
log.warn("""
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !
! WARNING! !
! !
! You just entered the danger zone! !
! Please pin the nf-schema version in your config! !
! Not pinning your version can't guarantee the reproducibility !
! and the functionality of this pipeline in the future !
! !
! plugins { !
! id "nf-schema@<version>" !
! } !
! !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
""")
}

this.session = session

// Help message logic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package nextflow.validation

import nextflow.Session
import nextflow.trace.TraceObserver

import groovy.util.logging.Slf4j

/**
* An observer for initial checks that always need to be run at the start of the pipeline
*
* @author : nvnieuwk <[email protected]>
*/


@Slf4j
class ValidationObserver implements TraceObserver {

@Override
void onFlowCreate(Session session) {
def plugins = session?.config?.navigate("plugins") as ArrayList
if(plugins?.contains("nf-schema")) {
log.warn("""
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !
! WARNING! !
! !
! You just entered the danger zone! !
! Please pin the nf-schema version in your config! !
! Not pinning your version can't guarantee the reproducibility !
! and the functionality of this pipeline in the future !
! !
! plugins { !
! id "nf-schema@<version>" !
! } !
! !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
""")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ValidationObserverFactory implements TraceObserverFactory {

@Override
Collection<TraceObserver> create(Session session) {
def List observers = []
def List observers = [ new ValidationObserver() ]
// Only enable the help observer when a help message needs to be printed
if(session.config.navigate('validation.help.enabled')) {
observers.add(new HelpObserver())
Expand Down
Loading