Skip to content

Commit

Permalink
Merge branch 'dev' into add-force_pr-to-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu authored Mar 7, 2024
2 parents bad2ffc + ad4dbb8 commit f8adf62
Show file tree
Hide file tree
Showing 41 changed files with 73 additions and 87 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.1
hooks:
- id: ruff # linter
args: [--fix, --exit-non-zero-on-fix] # sort imports and fix
Expand All @@ -9,6 +9,8 @@ repos:
rev: "v3.1.0"
hooks:
- id: prettier
additional_dependencies:
- prettier@3.2.5

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.3"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Update CI to use nf-core/setup-nextflow v2
- Changelog bot: handle also patch version before dev suffix ([#2820](https://github.com/nf-core/tools/pull/2820))
- Add `force_pr` flag to sync, to force a PR even though there are no changes committed ([#2822](https://github.com/nf-core/tools/pull/2822))
- update prettier to 3.2.5 ([#2830](https://github.com/nf-core/tools/pull/2830))
- Update GitHub Actions ([#2827](https://github.com/nf-core/tools/pull/2827))

## [v2.13.1 - Tin Puppy Patch](https://github.com/nf-core/tools/releases/tag/2.13) - [2024-02-29]
Expand Down
2 changes: 1 addition & 1 deletion nf_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Main nf_core module file.
"""Main nf_core module file.
Shouldn't do much, as everything is under subcommands.
"""
Expand Down
3 changes: 2 additions & 1 deletion nf_core/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
""" nf-core: Helper tools for use with nf-core Nextflow pipelines. """
"""nf-core: Helper tools for use with nf-core Nextflow pipelines."""

import logging
import os
import sys
Expand Down
7 changes: 3 additions & 4 deletions nf_core/components/components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The ComponentsTest class handles the generation and testing of nf-test snapshots.
"""


import logging
import os
import re
Expand Down Expand Up @@ -91,9 +90,9 @@ def run(self) -> None:
"""Run build steps"""
self.check_inputs()
os.environ["NFT_DIFF"] = "pdiff" # set nf-test differ to pdiff to get a better diff output
os.environ[
"NFT_DIFF_ARGS"
] = "--line-numbers --expand-tabs=2" # taken from https://code.askimed.com/nf-test/docs/assertions/snapshots/#snapshot-differences
os.environ["NFT_DIFF_ARGS"] = (
"--line-numbers --expand-tabs=2" # taken from https://code.askimed.com/nf-test/docs/assertions/snapshots/#snapshot-differences
)
with nf_core.utils.set_wd(Path(self.dir)):
self.check_snapshot_stability()
if len(self.errors) > 0:
Expand Down
1 change: 0 additions & 1 deletion nf_core/components/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The ComponentCreate class handles generating of module and subworkflow templates
"""


import glob
import json
import logging
Expand Down
1 change: 0 additions & 1 deletion nf_core/components/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
in nf-core pipelines
"""


import logging
import operator
import os
Expand Down
1 change: 1 addition & 0 deletions nf_core/components/nfcore_component.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The NFCoreComponent class holds information and utility functions for a single module or subworkflow
"""

import logging
import re
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions nf_core/create.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Creates a nf-core pipeline matching the current
organization's specification based on a template.
"""

import configparser
import logging
import os
Expand Down
3 changes: 1 addition & 2 deletions nf_core/launch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Launch a pipeline, interactively collecting params """

"""Launch a pipeline, interactively collecting params"""

import copy
import json
Expand Down
1 change: 0 additions & 1 deletion nf_core/licences.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Lists software licences for a given workflow."""


import json
import logging
import os
Expand Down
5 changes: 2 additions & 3 deletions nf_core/lint/nextflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,9 @@ def nextflow_config(self):
raise AssertionError()
except (AssertionError, IndexError):
failed.append(
"Config variable ``manifest.homePage`` did not begin with https://github.com/nf-core/:\n {}".format(
manifest_homepage
)
f"Config variable ``manifest.homePage`` did not begin with https://github.com/nf-core/:\n {manifest_homepage}"
)

else:
passed.append("Config variable ``manifest.homePage`` began with https://github.com/nf-core/")

Expand Down
1 change: 0 additions & 1 deletion nf_core/list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Lists available nf-core pipelines and versions."""


import json
import logging
import os
Expand Down
1 change: 0 additions & 1 deletion nf_core/modules/bump_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
or for a single module
"""


import logging
import os
import re
Expand Down
1 change: 0 additions & 1 deletion nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
nf-core modules lint
"""


import logging
import os

Expand Down
1 change: 1 addition & 0 deletions nf_core/modules/lint/module_changes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Check whether the content of a module has changed compared to the original repository
"""

import shutil
import tempfile
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions nf_core/modules/lint/module_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Lint the tests of a module in nf-core/modules
"""

import json
import logging
from pathlib import Path
Expand Down
3 changes: 1 addition & 2 deletions nf_core/params_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Create a YAML parameter file """

"""Create a YAML parameter file"""

import json
import logging
Expand Down
3 changes: 3 additions & 0 deletions nf_core/pipeline-template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ repos:
rev: "v3.1.0"
hooks:
- id: prettier
additional_dependencies:
- prettier@3.2.5

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.3"
hooks:
Expand Down
66 changes: 29 additions & 37 deletions nf_core/schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Code to deal with pipeline JSON Schema """

"""Code to deal with pipeline JSON Schema"""

import copy
import json
Expand Down Expand Up @@ -84,16 +83,13 @@ def load_lint_schema(self):
self.get_schema_defaults()
self.validate_default_params()
if len(self.invalid_nextflow_config_default_parameters) > 0:
params = "\n --".join(
[f"{param}: {msg}" for param, msg in self.invalid_nextflow_config_default_parameters.items()]
)
log.info(
"[red][✗] Invalid default parameters found:\n --{}\n\nNOTE: Use null in config for no default.".format(
"\n --".join(
[
f"{param}: {msg}"
for param, msg in self.invalid_nextflow_config_default_parameters.items()
]
)
)
f"[red][✗] Invalid default parameters found:\n {params} \n\nNOTE: Use null in config for no default."
)

else:
log.info(f"[green][✓] Pipeline schema looks valid[/] [dim](found {num_params} params)")
except json.decoder.JSONDecodeError as e:
Expand Down Expand Up @@ -282,9 +278,9 @@ def validate_default_params(self):
if param in self.pipeline_params:
self.validate_config_default_parameter(param, group_properties[param], self.pipeline_params[param])
else:
self.invalid_nextflow_config_default_parameters[
param
] = "Not in pipeline parameters. Check `nextflow.config`."
self.invalid_nextflow_config_default_parameters[param] = (
"Not in pipeline parameters. Check `nextflow.config`."
)

# Go over ungrouped params if any exist
ungrouped_properties = self.schema.get("properties")
Expand All @@ -297,9 +293,9 @@ def validate_default_params(self):
param, ungrouped_properties[param], self.pipeline_params[param]
)
else:
self.invalid_nextflow_config_default_parameters[
param
] = "Not in pipeline parameters. Check `nextflow.config`."
self.invalid_nextflow_config_default_parameters[param] = (
"Not in pipeline parameters. Check `nextflow.config`."
)

def validate_config_default_parameter(self, param, schema_param, config_default):
"""
Expand All @@ -314,9 +310,9 @@ def validate_config_default_parameter(self, param, schema_param, config_default)
):
# Check that we are not deferring the execution of this parameter in the schema default with squiggly brakcets
if schema_param["type"] != "string" or "{" not in schema_param["default"]:
self.invalid_nextflow_config_default_parameters[
param
] = f"Schema default (`{schema_param['default']}`) does not match the config default (`{config_default}`)"
self.invalid_nextflow_config_default_parameters[param] = (
f"Schema default (`{schema_param['default']}`) does not match the config default (`{config_default}`)"
)
return

# if default is null, we're good
Expand All @@ -326,28 +322,28 @@ def validate_config_default_parameter(self, param, schema_param, config_default)
# Check variable types in nextflow.config
if schema_param["type"] == "string":
if str(config_default) in ["false", "true", "''"]:
self.invalid_nextflow_config_default_parameters[
param
] = f"String should not be set to `{config_default}`"
self.invalid_nextflow_config_default_parameters[param] = (
f"String should not be set to `{config_default}`"
)
if schema_param["type"] == "boolean":
if str(config_default) not in ["false", "true"]:
self.invalid_nextflow_config_default_parameters[
param
] = f"Booleans should only be true or false, not `{config_default}`"
self.invalid_nextflow_config_default_parameters[param] = (
f"Booleans should only be true or false, not `{config_default}`"
)
if schema_param["type"] == "integer":
try:
int(config_default)
except ValueError:
self.invalid_nextflow_config_default_parameters[
param
] = f"Does not look like an integer: `{config_default}`"
self.invalid_nextflow_config_default_parameters[param] = (
f"Does not look like an integer: `{config_default}`"
)
if schema_param["type"] == "number":
try:
float(config_default)
except ValueError:
self.invalid_nextflow_config_default_parameters[
param
] = f"Does not look like a number (float): `{config_default}`"
self.invalid_nextflow_config_default_parameters[param] = (
f"Does not look like a number (float): `{config_default}`"
)

def validate_schema(self, schema=None):
"""
Expand Down Expand Up @@ -647,17 +643,13 @@ def build_schema(self, pipeline_dir, no_prompts, web_only, url):
# Extra help for people running offline
if "Could not connect" in e.args[0]:
log.info(
"If you're working offline, now copy your schema ({}) and paste at https://nf-co.re/pipeline_schema_builder".format(
self.schema_filename
)
f"If you're working offline, now copy your schema ({self.schema_filename}) and paste at https://nf-co.re/pipeline_schema_builder"
)
log.info("When you're finished, you can paste the edited schema back into the same file")
if self.web_schema_build_web_url:
log.info(
"To save your work, open {}\n"
"Click the blue 'Finished' button, copy the schema and paste into this file: {}".format(
self.web_schema_build_web_url, self.schema_filename
)
f"Click the blue 'Finished' button, copy the schema and paste into this file: { self.web_schema_build_web_url, self.schema_filename}"
)
return False

Expand Down
1 change: 0 additions & 1 deletion nf_core/subworkflows/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
nf-core subworkflows lint
"""


import logging
import os

Expand Down
1 change: 1 addition & 0 deletions nf_core/subworkflows/lint/subworkflow_changes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Check whether the content of a subworkflow has changed compared to the original repository
"""

from pathlib import Path

import nf_core.modules.modules_repo
Expand Down
1 change: 1 addition & 0 deletions nf_core/subworkflows/lint/subworkflow_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Lint the tests of a subworkflow in nf-core/modules
"""

import json
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Common utility functions for the nf-core python package.
"""

import concurrent.futures
import datetime
import errno
Expand Down
1 change: 1 addition & 0 deletions tests/components/generate_snapshot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test generate a snapshot"""

import json
from pathlib import Path
from unittest.mock import MagicMock
Expand Down
1 change: 1 addition & 0 deletions tests/components/snapshot_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the 'modules test' or 'subworkflows test' command which runs nf-test test."""

import shutil
from pathlib import Path

Expand Down
4 changes: 2 additions & 2 deletions tests/test_bump_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Some tests covering the bump_version code.
"""
"""Some tests covering the bump_version code."""

import os

import yaml
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Tests covering the command-line code.
"""Tests covering the command-line code.
Most tests check the cli arguments are passed along and that some action is
taken.
Expand Down
3 changes: 1 addition & 2 deletions tests/test_components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Tests covering the modules commands
"""
"""Tests covering the modules commands"""

import os
import shutil
Expand Down
4 changes: 2 additions & 2 deletions tests/test_create.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Some tests covering the pipeline creation sub command.
"""
"""Some tests covering the pipeline creation sub command."""

import os
import unittest
from pathlib import Path
Expand Down
3 changes: 1 addition & 2 deletions tests/test_download.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for the download subcommand of nf-core tools
"""
"""Tests for the download subcommand of nf-core tools"""

import os
import re
Expand Down
3 changes: 1 addition & 2 deletions tests/test_launch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Tests covering the pipeline launch code.
"""
"""Tests covering the pipeline launch code."""

import json
import os
Expand Down
3 changes: 1 addition & 2 deletions tests/test_licenses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Some tests covering the pipeline creation sub command.
"""
"""Some tests covering the pipeline creation sub command."""
# import json
# import os
# import tempfile
Expand Down
Loading

0 comments on commit f8adf62

Please sign in to comment.