From 91199fc7e7ad08b73f6e754f304ba4a88572638f Mon Sep 17 00:00:00 2001 From: fabianegli Date: Mon, 25 Jul 2022 18:05:47 +0200 Subject: [PATCH 01/13] provide ansi code stripping from utils --- docs/api/_src/api/lint.md | 2 +- nf_core/lint/__init__.py | 29 +++++++++++------------------ nf_core/utils.py | 12 ++++++++++++ tests/test_lint.py | 8 -------- tests/test_utils.py | 9 +++++++++ 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/docs/api/_src/api/lint.md b/docs/api/_src/api/lint.md index cb75b0ecb..1380f7ec7 100644 --- a/docs/api/_src/api/lint.md +++ b/docs/api/_src/api/lint.md @@ -14,6 +14,6 @@ See the [Lint Tests](../pipeline_lint_tests/index.md) docs for information about ```{eval-rst} .. autoclass:: nf_core.lint.PipelineLint :members: _lint_pipeline - :private-members: _print_results, _get_results_md, _save_json_results, _wrap_quotes, _strip_ansi_codes + :private-members: _print_results, _get_results_md, _save_json_results, _wrap_quotes :show-inheritance: ``` diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index 27619ad73..536a91c6b 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -24,6 +24,7 @@ from nf_core import __version__ from nf_core.lint_utils import console from nf_core.utils import plural_s as _s +from nf_core.utils import strip_ansi_codes log = logging.getLogger(__name__) @@ -458,7 +459,7 @@ def _get_results_md(self): "\n".join( [ f"* [{eid}](https://nf-co.re/tools-docs/lint_tests/{eid}.html) - " - f"{self._strip_ansi_codes(msg, '`')}" + f"{strip_ansi_codes(msg, '`')}" for eid, msg in self.failed ] ) @@ -472,7 +473,7 @@ def _get_results_md(self): "\n".join( [ f"* [{eid}](https://nf-co.re/tools-docs/lint_tests/{eid}.html) - " - f"{self._strip_ansi_codes(msg, '`')}" + f"{strip_ansi_codes(msg, '`')}" for eid, msg in self.ignored ] ) @@ -486,7 +487,7 @@ def _get_results_md(self): "\n".join( [ f"* [{eid}](https://nf-co.re/tools-docs/lint_tests/{eid}.html) - " - f"{self._strip_ansi_codes(msg, '`')}" + f"{strip_ansi_codes(msg, '`')}" for eid, msg in self.fixed ] ) @@ -500,7 +501,7 @@ def _get_results_md(self): "\n".join( [ f"* [{eid}](https://nf-co.re/tools-docs/lint_tests/{eid}.html) - " - f"{self._strip_ansi_codes(msg, '`')}" + f"{strip_ansi_codes(msg, '`')}" for eid, msg in self.warned ] ) @@ -515,7 +516,7 @@ def _get_results_md(self): [ ( f"* [{eid}](https://nf-co.re/tools-docs/lint_tests/{eid}.html)" - f" - {self._strip_ansi_codes(msg, '`')}" + f" - {strip_ansi_codes(msg, '`')}" ) for eid, msg in self.passed ] @@ -553,11 +554,11 @@ def _save_json_results(self, json_fn): results = { "nf_core_tools_version": nf_core.__version__, "date_run": now.strftime("%Y-%m-%d %H:%M:%S"), - "tests_pass": [[idx, self._strip_ansi_codes(msg)] for idx, msg in self.passed], - "tests_ignored": [[idx, self._strip_ansi_codes(msg)] for idx, msg in self.ignored], - "tests_fixed": [[idx, self._strip_ansi_codes(msg)] for idx, msg in self.fixed], - "tests_warned": [[idx, self._strip_ansi_codes(msg)] for idx, msg in self.warned], - "tests_failed": [[idx, self._strip_ansi_codes(msg)] for idx, msg in self.failed], + "tests_pass": [[idx, strip_ansi_codes(msg)] for idx, msg in self.passed], + "tests_ignored": [[idx, strip_ansi_codes(msg)] for idx, msg in self.ignored], + "tests_fixed": [[idx, strip_ansi_codes(msg)] for idx, msg in self.fixed], + "tests_warned": [[idx, strip_ansi_codes(msg)] for idx, msg in self.warned], + "tests_failed": [[idx, strip_ansi_codes(msg)] for idx, msg in self.failed], "num_tests_pass": len(self.passed), "num_tests_ignored": len(self.ignored), "num_tests_fixed": len(self.fixed), @@ -590,11 +591,3 @@ def _wrap_quotes(self, files): files = [files] bfiles = [f"`{f}`" for f in files] return " or ".join(bfiles) - - def _strip_ansi_codes(self, string, replace_with=""): - """Strip ANSI colouring codes from a string to return plain text. - - Solution found on Stack Overflow: https://stackoverflow.com/a/14693789/713980 - """ - ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") - return ansi_escape.sub(replace_with, string) diff --git a/nf_core/utils.py b/nf_core/utils.py index df5e3d5fc..6d757e06f 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -973,3 +973,15 @@ def plural_y(list_or_int): """Return 'ies' if the input is not one or has not the length of one, else 'y'.""" length = list_or_int if isinstance(list_or_int, int) else len(list_or_int) return "ies" if length != 1 else "y" + + +# From Stack Overflow: https://stackoverflow.com/a/14693789/713980 +ANSI_ESCAPE_RE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") + + +def strip_ansi_codes(string, replace_with=""): + """Strip ANSI colouring codes from a string to return plain text. + + From Stack Overflow: https://stackoverflow.com/a/14693789/713980 + """ + return ANSI_ESCAPE_RE.sub(replace_with, string) diff --git a/tests/test_lint.py b/tests/test_lint.py index b7275c8c4..5257d25e1 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -153,14 +153,6 @@ def test_wrap_quotes(self): md = self.lint_obj._wrap_quotes(["one", "two", "three"]) assert md == "`one` or `two` or `three`" - def test_strip_ansi_codes(self): - """Check that we can make rich text strings plain - - String prints ls examplefile.zip, where examplefile.zip is red bold text - """ - stripped = self.lint_obj._strip_ansi_codes("ls \x1b[00m\x1b[01;31mexamplefile.zip\x1b[00m\x1b[01;31m") - assert stripped == "ls examplefile.zip" - def test_sphinx_md_files(self): """Check that we have .md files for all lint module code, and that there are no unexpected files (eg. deleted lint tests)""" diff --git a/tests/test_utils.py b/tests/test_utils.py index dd972a737..4c0f37190 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -18,6 +18,15 @@ from .utils import with_temporary_folder +def test_strip_ansi_codes(): + """Check that we can make rich text strings plain + + String prints ls examplefile.zip, where examplefile.zip is red bold text + """ + stripped = nf_core.utils.strip_ansi_codes("ls \x1b[00m\x1b[01;31mexamplefile.zip\x1b[00m\x1b[01;31m") + assert stripped == "ls examplefile.zip" + + class TestUtils(unittest.TestCase): """Class for utils tests""" From 18479022cd8c7480576996ee03c81edcb0879684 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 28 Jul 2022 13:55:15 +0200 Subject: [PATCH 02/13] add flag no_git=True when initialising git repository for a pipeline is not needed --- nf_core/lint/files_unchanged.py | 2 +- tests/test_bump_version.py | 6 +++--- tests/test_launch.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nf_core/lint/files_unchanged.py b/nf_core/lint/files_unchanged.py index f5222c051..7c82d9961 100644 --- a/nf_core/lint/files_unchanged.py +++ b/nf_core/lint/files_unchanged.py @@ -133,7 +133,7 @@ def files_unchanged(self): test_pipeline_dir = os.path.join(tmp_dir, f"{prefix}-{short_name}") create_obj = nf_core.create.PipelineCreate( - None, None, None, outdir=test_pipeline_dir, template_yaml_path=template_yaml_path + None, None, None, no_git=True, outdir=test_pipeline_dir, template_yaml_path=template_yaml_path ) create_obj.init_pipeline() diff --git a/tests/test_bump_version.py b/tests/test_bump_version.py index 01483550f..96eb1240a 100644 --- a/tests/test_bump_version.py +++ b/tests/test_bump_version.py @@ -18,7 +18,7 @@ def test_bump_pipeline_version(datafiles, tmp_path): # Get a workflow and configs test_pipeline_dir = os.path.join(tmp_path, "nf-core-testpipeline") create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", outdir=test_pipeline_dir, plain=True + "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=test_pipeline_dir, plain=True ) create_obj.init_pipeline() pipeline_obj = nf_core.utils.Pipeline(test_pipeline_dir) @@ -38,7 +38,7 @@ def test_dev_bump_pipeline_version(datafiles, tmp_path): # Get a workflow and configs test_pipeline_dir = os.path.join(tmp_path, "nf-core-testpipeline") create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", outdir=test_pipeline_dir, plain=True + "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=test_pipeline_dir, plain=True ) create_obj.init_pipeline() pipeline_obj = nf_core.utils.Pipeline(test_pipeline_dir) @@ -57,7 +57,7 @@ def test_bump_nextflow_version(datafiles, tmp_path): # Get a workflow and configs test_pipeline_dir = os.path.join(tmp_path, "nf-core-testpipeline") create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", outdir=test_pipeline_dir, plain=True + "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=test_pipeline_dir, plain=True ) create_obj.init_pipeline() pipeline_obj = nf_core.utils.Pipeline(test_pipeline_dir) diff --git a/tests/test_launch.py b/tests/test_launch.py index f3b1d469b..6d6d2e956 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -72,7 +72,7 @@ def test_make_pipeline_schema(self, tmp_path): """Create a workflow, but delete the schema file, then try to load it""" test_pipeline_dir = os.path.join(tmp_path, "wf") create_obj = nf_core.create.PipelineCreate( - "test_pipeline", "", "", outdir=test_pipeline_dir, no_git=True, plain=True + "test_pipeline", "", "", no_git=True, outdir=test_pipeline_dir, no_git=True, plain=True ) create_obj.init_pipeline() os.remove(os.path.join(test_pipeline_dir, "nextflow_schema.json")) From b2a1dbcdf9cb878e8fe3952b8d9ed3064fb0f452 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 28 Jul 2022 14:17:24 +0200 Subject: [PATCH 03/13] more no_git modifications --- tests/test_launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_launch.py b/tests/test_launch.py index 6d6d2e956..f3b1d469b 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -72,7 +72,7 @@ def test_make_pipeline_schema(self, tmp_path): """Create a workflow, but delete the schema file, then try to load it""" test_pipeline_dir = os.path.join(tmp_path, "wf") create_obj = nf_core.create.PipelineCreate( - "test_pipeline", "", "", no_git=True, outdir=test_pipeline_dir, no_git=True, plain=True + "test_pipeline", "", "", outdir=test_pipeline_dir, no_git=True, plain=True ) create_obj.init_pipeline() os.remove(os.path.join(test_pipeline_dir, "nextflow_schema.json")) From 01933e904b51dd0b2e2d8e4bd86fa9d8bd99c6b6 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 28 Jul 2022 15:12:41 +0200 Subject: [PATCH 04/13] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee5c7235..f18a00874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Use black also to format python files in workflows ([#1563](https://github.com/nf-core/tools/pull/1563)) - Add check for mimetype in the `input` parameter. ([#1647](https://github.com/nf-core/tools/issues/1647)) - Check that the singularity and docker tags are parsable. Add `--fail-warned` flag to `nf-core modules lint` ([#1654](https://github.com/nf-core/tools/issues/1654)) +- Don't initialise git pipeline repository from the temporary pipeline created by `nf-core lint` ### General @@ -40,6 +41,7 @@ - Allow customization of the `nf-core` pipeline template when using `nf-core create` ([#1548](https://github.com/nf-core/tools/issues/1548)) - Add Refgenie integration: updating of nextflow config files with a refgenie database ([#1090](https://github.com/nf-core/tools/pull/1090)) - Fix `--key` option in `nf-core lint` when supplying a module lint test name ([#1681](https://github.com/nf-core/tools/issues/1681)) +- Add `no_git=True` when creating a new pipeline and initialising a git repository is not needed ([#1709](https://github.com/nf-core/tools/pull/1709)) ### Modules From d2650a0f0a8b3a9621e70c0792c08b4320e9b629 Mon Sep 17 00:00:00 2001 From: fabianegli Date: Thu, 28 Jul 2022 17:02:36 +0200 Subject: [PATCH 05/13] fix comparisons pylint-C0301 --- nf_core/__main__.py | 2 +- nf_core/modules/info.py | 2 +- nf_core/utils.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index e6b5a3246..4107a05d6 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -191,7 +191,7 @@ def launch(pipeline, id, revision, command_only, params_in, params_out, save_all launcher = nf_core.launch.Launch( pipeline, revision, command_only, params_in, params_out, save_all, show_hidden, url, id ) - if launcher.launch_pipeline() == False: + if not launcher.launch_pipeline(): sys.exit(1) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index 3a374e72f..49bf4f68a 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -83,7 +83,7 @@ def get_module_info(self): self.meta = self.get_remote_yaml() # Could not find the meta - if self.meta == False: + if not self.meta: raise UserWarning(f"Could not find module '{self.module}'") return self.generate_module_info_help() diff --git a/nf_core/utils.py b/nf_core/utils.py index df5e3d5fc..a52c90602 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -65,14 +65,14 @@ def check_if_outdated(current_version=None, remote_version=None, source_url="htt if os.environ.get("NFCORE_NO_VERSION_CHECK", False): return True # Set and clean up the current version string - if current_version == None: + if current_version is None: current_version = nf_core.__version__ current_version = re.sub(r"[^0-9\.]", "", current_version) # Build the URL to check against source_url = os.environ.get("NFCORE_VERSION_URL", source_url) source_url = f"{source_url}?v={current_version}" # Fetch and clean up the remote version - if remote_version == None: + if remote_version is None: response = requests.get(source_url, timeout=3) remote_version = re.sub(r"[^0-9\.]", "", response.text) # Check if we have an available update From b1e89877ee9ca43fb50939aa53927255f77745c1 Mon Sep 17 00:00:00 2001 From: fabianegli Date: Thu, 28 Jul 2022 17:07:39 +0200 Subject: [PATCH 06/13] simplify control flow --- nf_core/modules/info.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index 49bf4f68a..a1242211e 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -46,9 +46,7 @@ def init_mod_name(self, module): Args: module: str: Module name to check """ - if module is not None: - return module - else: + if module is None: local = questionary.confirm( "Is the module locally installed?", style=nf_core.utils.nfcore_question_style ).unsafe_ask() @@ -69,7 +67,8 @@ def init_mod_name(self, module): module = questionary.autocomplete( "Please select a new module", choices=modules, style=nf_core.utils.nfcore_question_style ).unsafe_ask() - return module + + return module def get_module_info(self): """Given the name of a module, parse meta.yml and print usage help.""" @@ -114,7 +113,6 @@ def get_local_yaml(self): return yaml.safe_load(fh) log.debug(f"Module '{self.module}' meta.yml not found locally") - return None else: module_base_path = os.path.join(self.dir, "modules") if self.module in os.listdir(module_base_path): @@ -126,7 +124,8 @@ def get_local_yaml(self): self.local_path = mod_dir return yaml.safe_load(fh) log.debug(f"Module '{self.module}' meta.yml not found locally") - return None + + return None def get_remote_yaml(self): """Attempt to get the meta.yml file from a remote repo. From bc538812ad5b2365076e00f4770a9af3e2e719d3 Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Thu, 28 Jul 2022 17:28:29 +0200 Subject: [PATCH 07/13] readability counts --- nf_core/modules/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/info.py b/nf_core/modules/info.py index a1242211e..8d8b62f29 100644 --- a/nf_core/modules/info.py +++ b/nf_core/modules/info.py @@ -82,7 +82,7 @@ def get_module_info(self): self.meta = self.get_remote_yaml() # Could not find the meta - if not self.meta: + if self.meta is False: raise UserWarning(f"Could not find module '{self.module}'") return self.generate_module_info_help() From bcdcd953fa2859c532cefd35b6e98df1b9ed45e9 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 29 Jul 2022 09:08:02 +0200 Subject: [PATCH 08/13] fix changelog error --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ebbaf014..0d0108dc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,6 @@ - Use black also to format python files in workflows ([#1563](https://github.com/nf-core/tools/pull/1563)) - Add check for mimetype in the `input` parameter. ([#1647](https://github.com/nf-core/tools/issues/1647)) - Check that the singularity and docker tags are parsable. Add `--fail-warned` flag to `nf-core modules lint` ([#1654](https://github.com/nf-core/tools/issues/1654)) -- Don't initialise git pipeline repository from the temporary pipeline created by `nf-core lint` ### General @@ -41,7 +40,7 @@ - Allow customization of the `nf-core` pipeline template when using `nf-core create` ([#1548](https://github.com/nf-core/tools/issues/1548)) - Add Refgenie integration: updating of nextflow config files with a refgenie database ([#1090](https://github.com/nf-core/tools/pull/1090)) - Fix `--key` option in `nf-core lint` when supplying a module lint test name ([#1681](https://github.com/nf-core/tools/issues/1681)) -- Add `no_git=True` when creating a new pipeline and initialising a git repository is not needed ([#1709](https://github.com/nf-core/tools/pull/1709)) +- Add `no_git=True` when creating a new pipeline and initialising a git repository is not needed in `nf-core lint` and `nf-core bump-version` ([#1709](https://github.com/nf-core/tools/pull/1709)) ### Modules From ca5f586739454f26e003dc1059878e5964f2c1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Fri, 29 Jul 2022 10:38:56 +0000 Subject: [PATCH 09/13] add no_git flag to more tests --- tests/test_download.py | 2 +- tests/test_modules.py | 2 +- tests/test_utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_download.py b/tests/test_download.py index 21a8e2e9a..7b67c3966 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -105,7 +105,7 @@ def test_wf_use_local_configs(self, tmp_path): # Get a workflow and configs test_pipeline_dir = os.path.join(tmp_path, "nf-core-testpipeline") create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", outdir=test_pipeline_dir, plain=True + "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=test_pipeline_dir, plain=True ) create_obj.init_pipeline() diff --git a/tests/test_modules.py b/tests/test_modules.py index b310c9a73..012691b75 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -44,7 +44,7 @@ def setUp(self): self.template_dir = os.path.join(root_repo_dir, "nf_core", "pipeline-template") self.pipeline_dir = os.path.join(self.tmp_dir, "mypipeline") nf_core.create.PipelineCreate( - "mypipeline", "it is mine", "me", outdir=self.pipeline_dir, plain=True + "mypipeline", "it is mine", "me", no_git=True, outdir=self.pipeline_dir, plain=True ).init_pipeline() # Set up install objects print("Setting up install objects") diff --git a/tests/test_utils.py b/tests/test_utils.py index dd972a737..bdb9f18e5 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -29,7 +29,7 @@ def setUp(self): self.tmp_dir = tempfile.mkdtemp() self.test_pipeline_dir = os.path.join(self.tmp_dir, "nf-core-testpipeline") self.create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", outdir=self.test_pipeline_dir, plain=True + "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=self.test_pipeline_dir, plain=True ) self.create_obj.init_pipeline() # Base Pipeline object on this directory From 3bf6d70affe3ada9980621c8499de4c153c2ad84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Fri, 29 Jul 2022 10:45:12 +0000 Subject: [PATCH 10/13] run black --- tests/test_download.py | 7 ++++++- tests/test_utils.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_download.py b/tests/test_download.py index 7b67c3966..41994412f 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -105,7 +105,12 @@ def test_wf_use_local_configs(self, tmp_path): # Get a workflow and configs test_pipeline_dir = os.path.join(tmp_path, "nf-core-testpipeline") create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=test_pipeline_dir, plain=True + "testpipeline", + "This is a test pipeline", + "Test McTestFace", + no_git=True, + outdir=test_pipeline_dir, + plain=True, ) create_obj.init_pipeline() diff --git a/tests/test_utils.py b/tests/test_utils.py index bdb9f18e5..dbd950ab3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -29,7 +29,12 @@ def setUp(self): self.tmp_dir = tempfile.mkdtemp() self.test_pipeline_dir = os.path.join(self.tmp_dir, "nf-core-testpipeline") self.create_obj = nf_core.create.PipelineCreate( - "testpipeline", "This is a test pipeline", "Test McTestFace", no_git=True, outdir=self.test_pipeline_dir, plain=True + "testpipeline", + "This is a test pipeline", + "Test McTestFace", + no_git=True, + outdir=self.test_pipeline_dir, + plain=True, ) self.create_obj.init_pipeline() # Base Pipeline object on this directory From 8521385bba16fb7e8b76c9350013c8317a6243d2 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Mon, 1 Aug 2022 11:50:44 +0200 Subject: [PATCH 11/13] launch_pipeline returns true if success --- nf_core/launch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nf_core/launch.py b/nf_core/launch.py index 45d4cb3ef..3e37c2116 100644 --- a/nf_core/launch.py +++ b/nf_core/launch.py @@ -182,6 +182,7 @@ def launch_pipeline(self): # Build and launch the `nextflow run` command self.build_command() self.launch_workflow() + return True def get_pipeline_schema(self): """Load and validate the schema from the supplied pipeline""" From c4f49109dd3f6b6c651c23e9d53f02d815ea1f52 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Mon, 1 Aug 2022 11:52:56 +0200 Subject: [PATCH 12/13] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0108dc2..ebceaf21b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - Add Refgenie integration: updating of nextflow config files with a refgenie database ([#1090](https://github.com/nf-core/tools/pull/1090)) - Fix `--key` option in `nf-core lint` when supplying a module lint test name ([#1681](https://github.com/nf-core/tools/issues/1681)) - Add `no_git=True` when creating a new pipeline and initialising a git repository is not needed in `nf-core lint` and `nf-core bump-version` ([#1709](https://github.com/nf-core/tools/pull/1709)) +- Simplify control flow and don't use equality comparision for `None` and booleans ### Modules From 611f4d1d6c1a1fdc57c75279a7751e238a5cbb4e Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Mon, 1 Aug 2022 11:56:53 +0200 Subject: [PATCH 13/13] Update changelog and improve comment --- CHANGELOG.md | 1 + nf_core/utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be98a25f3..539d8891a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Allow customization of the `nf-core` pipeline template when using `nf-core create` ([#1548](https://github.com/nf-core/tools/issues/1548)) - Add Refgenie integration: updating of nextflow config files with a refgenie database ([#1090](https://github.com/nf-core/tools/pull/1090)) - Fix `--key` option in `nf-core lint` when supplying a module lint test name ([#1681](https://github.com/nf-core/tools/issues/1681)) +- Move `strip_ansi_code` function in lint to `utils.py` ### Modules diff --git a/nf_core/utils.py b/nf_core/utils.py index 6d757e06f..f9f17a984 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -976,6 +976,7 @@ def plural_y(list_or_int): # From Stack Overflow: https://stackoverflow.com/a/14693789/713980 +# Placed at top level as to only compile it once ANSI_ESCAPE_RE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")