Skip to content

Commit

Permalink
Error & info messages, code comments language fixes (#3475)
Browse files Browse the repository at this point in the history

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
llewellyn-sl and pditommaso committed Dec 11, 2022
1 parent ac0c303 commit 29ae36c
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ class GithubRepositoryPublisher extends DefaultTask {
}
else {
for (PluginRelease rel : pluginReleases) {
// check if this version already exist in the index
// check if this version already exists in the index
final index = indexEntry.releases.findIndexOf { PluginRelease it -> it.version == rel.version }
final indexRel = index!=-1 ? indexEntry.releases[index] : null as PluginRelease

// if not exists, add to the index
// if not, add to the index
if( !indexRel ) {
indexEntry.releases << rel
}
// otherwise verify the checksum matches
// otherwise, verify the checksum matches
else if( indexRel.sha512sum != rel.sha512sum ) {
if( overwrite ) {
indexEntry.releases[index] = rel
Expand Down Expand Up @@ -113,7 +113,7 @@ class GithubRepositoryPublisher extends DefaultTask {


/*
* Traverse a S3 bucket and return a map given all releases for each
* Traverse an S3 bucket and return a map with all releases for each
* plugin id
*
* @return The map holding the plugin releases for each plugin id
Expand Down Expand Up @@ -152,7 +152,7 @@ class GithubRepositoryPublisher extends DefaultTask {
final metaFile = "${repo}-${version}-meta.json"
final json = client.getReleaseAsset(version, metaFile)?.text
if( !json )
throw new GradleException("Can't load plugin release metafile $metaFile")
throw new GradleException("Failed to load plugin release metafile $metaFile")
return new Gson().fromJson(json, PluginRelease)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ class GithubUploader extends DefaultTask {
return

if( !sourceFile.exists() )
throw new GradleException("Github upload failed -- Source file does not exists: $sourceFile")
throw new GradleException("Github upload failed -- source file does not exist: $sourceFile")

final fileName = sourceFile.name
final asset = client.getReleaseAsset(release.get(), fileName)
if ( asset ) {
if( skipExisting && isSame(sourceFile, asset) ) {
logger.quiet("${owner}/${repo.get()}/${fileName} exists! -- Skipping it.")
logger.quiet("${owner}/${repo.get()}/${fileName} already exists -- skipping")
}
else if (overwrite) {
updateRelease(sourceFile)
}
else {
throw new GradleException("${owner}/${repo.get()}/${fileName} exists! -- Refuse to owerwrite it.")
throw new GradleException("${owner}/${repo.get()}/${fileName} already exists -- overwrite refused")
}
}
else {
Expand All @@ -106,7 +106,7 @@ class GithubUploader extends DefaultTask {

private void updateRelease(File sourceFile) {
if( dryRun ) {
logger.quiet("Would update ${sourceFile} → github.com://$owner/${repo.get()}")
logger.quiet("Will update ${sourceFile} → github.com://$owner/${repo.get()}")
}
else {
logger.quiet("Updating ${sourceFile} → github.com://$owner/${repo.get()}")
Expand All @@ -117,7 +117,7 @@ class GithubUploader extends DefaultTask {

private void uploadRelease(File sourceFile) {
if( dryRun ) {
logger.quiet("Would upload ${sourceFile} → github.com://$owner/${repo.get()}")
logger.quiet("Will upload ${sourceFile} → github.com://$owner/${repo.get()}")
}
else {
logger.quiet("Uploading ${sourceFile} → github.com://$owner/${repo.get()}")
Expand Down Expand Up @@ -155,15 +155,15 @@ class GithubUploader extends DefaultTask {
def j1 = gson.fromJson(sourceFile.text, Map)
def j2 = gson.fromJson( new InputStreamReader(asset), Map)
if( j1.version != j2.version ) {
logger.quiet("Plugin metafile $sourceFile not matching versions: local=$j1.version; remote: $j2.version")
logger.quiet("Plugin metafile $sourceFile does not match versions: local=$j1.version; remote: $j2.version")
return false
}
if( j1.url != j2.url ) {
logger.quiet("Plugin metafile $sourceFile not matching urls: local=$j1.url; remote: $j2.url")
logger.quiet("Plugin metafile $sourceFile does not match urls: local=$j1.url; remote: $j2.url")
return false
}
if( j1.sha512sum != j2.sha512sum ) {
logger.quiet("Plugin metafile $sourceFile not matching sha512sum: local=$j1.sha512sum; remote: $j2.sha512sum")
logger.quiet("Plugin metafile $sourceFile does not match sha512sum: local=$j1.sha512sum; remote: $j2.sha512sum")
return false
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ class S3Upload extends AbstractS3Task {
final targetUrl = target.get()
final urlTokens = BucketTokenizer.from(targetUrl)
if( urlTokens.scheme != 's3' )
throw new GradleException("S3 upload failed -- Invalid target s3 path: $targetUrl")
throw new GradleException("S3 upload failed -- invalid target s3 path: $targetUrl")
final bucket = urlTokens.bucket
final targetKey = urlTokens.key

if( !sourceFile.exists() )
throw new GradleException("S3 upload failed -- Source file does not exists: $sourceFile")
throw new GradleException("S3 upload failed -- source file does not exist: $sourceFile")

if (s3Client.doesObjectExist(bucket, targetKey)) {
if( skipExisting ) {
logger.quiet("s3://${bucket}/${targetKey} exists. Skipping it!")
logger.quiet("s3://${bucket}/${targetKey} already exists -- skipping")
}
else if (overwrite) {
copy(sourceFile, bucket, targetKey, true)
}
else if( isSameContent(sourceFile, bucket, targetKey) ) {
logger.quiet("s3://${bucket}/${targetKey} exists!")
logger.quiet("s3://${bucket}/${targetKey} already exists")
}
else {
throw new GradleException("s3://${bucket}/${targetKey} exists! -- Refuse to owerwrite it.")
throw new GradleException("s3://${bucket}/${targetKey} already exists -- overwrite refused")
}
}
else {
Expand All @@ -88,14 +88,14 @@ class S3Upload extends AbstractS3Task {

void copy(File sourceFile, String bucket, String targetKey, boolean exists) {
if( dryRun ) {
logger.quiet("S3 Would upload ${sourceFile} → s3://${bucket}/${targetKey} ${exists ? '[would overwrite existing]' : ''}")
logger.quiet("S3 will upload ${sourceFile} → s3://${bucket}/${targetKey} ${exists ? '[would overwrite existing]' : ''}")
}
else {
final req = new PutObjectRequest(bucket, targetKey, sourceFile)
if( publicRead )
req.withCannedAcl(CannedAccessControlList.PublicRead)

logger.quiet("S3 Upload ${sourceFile} → s3://${bucket}/${targetKey} ${exists ? '[overwrite existing]': ''}")
logger.quiet("S3 upload ${sourceFile} → s3://${bucket}/${targetKey} ${exists ? '[overwrite existing]': ''}")
s3Client.putObject(req)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class BucketTokenizer {
}

/**
* @return The object key, essentially the same as {@link #path} stripping the leading slash character
* @return The object key, effectively the same as {@link #path} stripping the leading slash character
*/
String getKey() {
path?.startsWith('/') ? path.substring(1) : path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class GithubClient {
}

/**
* 2. Create the blobs with the files content
* 2. Create the blobs with the file content
*
* @param file content
* @return The SHA id of the uploaded content
Expand All @@ -93,7 +93,7 @@ class GithubClient {
}

/**
* 3. Create a tree which defines the file structure
* 3. Create a tree that defines the file structure
*
* @param fileName The name of the file changed
* @param blobId The id of the changed content
Expand Down
8 changes: 4 additions & 4 deletions modules/nextflow/src/main/groovy/nextflow/NextflowMeta.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import static nextflow.extension.Bolts.DATETIME_FORMAT
@EqualsAndHashCode
class NextflowMeta {

private static final String DSL1_EOL_MESSAGE = "Nextflow DSL1 is no longer supported — Please update your script to DSL2 or use Nextflow 22.10.x or an earlier version"
private static final String DSL1_EOL_MESSAGE = "Nextflow DSL1 is no longer supported — Update your script to DSL2, or use Nextflow 22.10.x or earlier"
private static final Pattern DSL_DECLARATION = ~/(?m)^\s*(nextflow\.(preview|enable)\.dsl\s*=\s*(\d))\s*(;?\s*)?(;?\/{2}.*)?$/

private static final Pattern DSL1_INPUT = ~/(?m)input:\s*(tuple|file|path|val|env|stdin)\b.*\s.*\bfrom\b.+$/
Expand All @@ -50,13 +50,13 @@ class NextflowMeta {
if( num != 2 )
throw new IllegalArgumentException("Not a valid DSL version number: $num")
if( num == 2 && !ignoreWarnDsl2 )
log.warn1 "DSL 2 PREVIEW MODE IS DEPRECATED - USE THE STABLE VERSION INSTEAD -- Read more at https://www.nextflow.io/docs/latest/dsl2.html#dsl2-migration-notes"
log.warn1 "DSL 2 PREVIEW MODE IS DEPRECATED - USE THE STABLE VERSION INSTEAD. Read more at https://www.nextflow.io/docs/latest/dsl2.html#dsl2-migration-notes"
dsl = num
}

void setRecursion(Boolean recurse) {
if( recurse )
log.warn "NEXTFLOW RECURSION IS A PREVIEW FEATURE - SYNTAX AND FUNCTIONALITY CAN CHANGE IN FUTURE RELEASE"
log.warn "NEXTFLOW RECURSION IS A PREVIEW FEATURE - SYNTAX AND FUNCTIONALITY CAN CHANGE IN FUTURE RELEASES"
this.recursion = recurse
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ class NextflowMeta {
return ver
}
else if( mode == 'preview' )
throw new IllegalArgumentException("Preview nextflow mode 'preview' is not supported anymore -- Please use `nextflow.enable.dsl=2` instead")
throw new IllegalArgumentException("Preview nextflow mode ('preview') is no longer supported —- use `nextflow.enable.dsl=2` instead")
else
throw new IllegalArgumentException("Unknown nextflow mode=${matcher.group(1)}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class DirWatcherV2 implements DirListener, FileAlterationListener {
void apply( Closure onNext ) {
this.onNext = onNext
if( !base.isDirectory() ) {
log.warn "Cannot watch a non-existent directory: $base -- Make sure that the path exists and is a directory"
log.warn "Cannot watch a non-existent directory: $base -- Ensure the path is a valid directory"
onComplete?.call()
return
}
Expand Down
24 changes: 12 additions & 12 deletions modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ class PluginsFacade implements PluginStateListener {
return env.NXF_PLUGINS_DEFAULT!='false'
}
else if( env.containsKey('NXF_HOME') ) {
log.trace "Detected NXF_HOME - Using plugins defaults"
log.trace "Detected NXF_HOME - Using plugin defaults"
return true
}
else {
log.trace "Disabling plugins defaults"
log.trace "Disabling plugin defaults"
return false
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ class PluginsFacade implements PluginStateListener {

void init(boolean embedded=false) {
if( manager )
throw new IllegalArgumentException("Plugin system was already setup")
throw new IllegalArgumentException("Plugin system already setup")

log.debug "Setting up plugin manager > mode=${mode}; embedded=$embedded; plugins-dir=$root; core-plugins: ${defaultPlugins.toSortedString()}"
// make sure plugins dir exists
Expand All @@ -205,7 +205,7 @@ class PluginsFacade implements PluginStateListener {

void init(Path root, String mode, CustomPluginManager pluginManager) {
if( manager )
throw new IllegalArgumentException("Plugin system was already setup")
throw new IllegalArgumentException("Plugin system already setup")
this.root = root
this.mode = mode
// setup plugin manager
Expand All @@ -228,7 +228,7 @@ class PluginsFacade implements PluginStateListener {

void load(Map config) {
if( !manager )
throw new IllegalArgumentException("Plugin system has not been initialised yet")
throw new IllegalArgumentException("Plugin system has not been initialized")
start(pluginsRequirement(config))
}

Expand All @@ -255,7 +255,7 @@ class PluginsFacade implements PluginStateListener {
// this should oly be used to load system extensions
// i.e. included in the app class path not provided by
// a plugin extension
log.debug "Using Default plugins manager"
log.debug "Using Default plugin manager"
return defaultManager().getExtensions(type)
}
}
Expand Down Expand Up @@ -312,7 +312,7 @@ class PluginsFacade implements PluginStateListener {

void start( String pluginId ) {
if( isSelfContained() && defaultPlugins.hasPlugin(pluginId) ) {
log.debug "Plugin 'start' is not required in self-contained mode -- ignoring it for plugin: $pluginId"
log.debug "Plugin 'start' is not required in self-contained mode -- ignoring for plugin: $pluginId"
return
}

Expand All @@ -321,7 +321,7 @@ class PluginsFacade implements PluginStateListener {

void start(PluginSpec plugin) {
if( isSelfContained() && defaultPlugins.hasPlugin(plugin.id) ) {
log.debug "Plugin 'start' is not required in self-contained mode -- ignoring it for plugin: $plugin.id"
log.debug "Plugin 'start' is not required in self-contained mode -- ignoring for plugin: $plugin.id"
return
}

Expand Down Expand Up @@ -351,7 +351,7 @@ class PluginsFacade implements PluginStateListener {
def specs = parseConf(config)
if( isSelfContained() && specs ) {
// custom plugins are not allowed for nextflow self-contained package
log.warn "Nextflow self-contained distribution only allows core plugins -- User config plugins will be ignored: ${specs.join(',')}"
log.warn "Nextflow self-contained distribution allows only core plugins -- User config plugins will be ignored: ${specs.join(',')}"
return Collections.emptyList()
}
if( specs ) {
Expand Down Expand Up @@ -441,14 +441,14 @@ class PluginsFacade implements PluginStateListener {
}

/**
* Merge two list of plugins requirement
* Merge two lists of plugin requirements
*
* @param configPlugins
* The list of plugins specified via the configuration file. This has higher priority
* @param defaultPlugins
* The list of plugins specified via the environment
* @return
* The list of plugins resulting from merging the twos
* The list of plugins resulting from merging the two lists
*/
protected List<PluginSpec> mergePluginSpecs(List<PluginSpec> configPlugins, List<PluginSpec> defaultPlugins) {
final map = new LinkedHashMap<String,PluginSpec>(10)
Expand All @@ -457,7 +457,7 @@ class PluginsFacade implements PluginStateListener {
map.put(plugin.id, plugin)
}
// add the plugin in the 'defaultPlugins' argument
// when the map contains already the plugin,
// if the map already contains the plugin,
// override it only if it does not specify a version
for( PluginSpec plugin : defaultPlugins ) {
if( !map[plugin.id] || !map[plugin.id].version ) {
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-commons/src/main/nextflow/util/Base62.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static BigInteger decode(final String string, int bitLimit) {
int digit = DIGITS.indexOf(string.charAt(digits - index - 1));
result = result.add(BigInteger.valueOf(digit).multiply(BASE.pow(index)));
if (bitLimit > 0 && result.bitLength() > bitLimit) {
throwIllegalArgumentException("String contains '%s' more than 128bit information (%sbit)", string, result.bitLength());
throwIllegalArgumentException("String contains '%s' more than 128-bit information (%sbit)", string, result.bitLength());
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ServiceDiscover<S> {

if (n != 0) {
if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
fail(service, u, lc, "Illegal configuration-file syntax")
fail(service, u, lc, "Illegal configuration file syntax")

int cp = ln.codePointAt(0)
if (!Character.isJavaIdentifierStart(cp))
Expand Down
6 changes: 3 additions & 3 deletions modules/nf-httpfs/src/main/nextflow/file/http/XPath.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class XPath implements Path {
}

/**
* @return The unique hash code for this pah
* @return The unique hash code for this path
*/
@Override
int hashCode() {
Expand All @@ -284,11 +284,11 @@ class XPath implements Path {
* Path factory method.
*
* @param str
* A fully qualified URI path string e.g. {@code http://www.host.name/data.file.txt}
* A fully qualified URI path string, e.g. {@code http://www.host.name/data.file.txt}
* @return
* The corresponding {@link XPath} object
* @throws
* ProviderMismatchException When the URI scheme does not match any supported protocol i.e. {@code ftp},
* ProviderMismatchException When the URI scheme does not match any supported protocol, i.e. {@code ftp},
* {@code http}, {@code https}
*/
static XPath get(String str) {
Expand Down

0 comments on commit 29ae36c

Please sign in to comment.