diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ef314297..d7e1afb421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Template - Fix lint warnings for `samplesheet_check.nf` module +- Check that the workflow name provided with a template doesn't contain dashes ([#1822](https://github.com/nf-core/tools/pull/1822)) ### Linting diff --git a/nf_core/create.py b/nf_core/create.py index 8124ea21b2..bd00dd1517 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -167,6 +167,11 @@ def create_param_dict(self, name, description, author, version, template_yaml_pa param_dict["logo_dark"] = f"{param_dict['name_noslash']}_logo_dark.png" param_dict["version"] = version + # Check that the pipeline name matches the requirements + if not re.match(r"^[a-z]+$", param_dict["short_name"]): + log.error("[red]Invalid workflow name: must be lowercase without punctuation.") + sys.exit(1) + return param_dict, skip_paths def customize_template(self, template_areas): diff --git a/tests/test_launch.py b/tests/test_launch.py index c7ff8bdd7c..4d4ed79649 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -73,7 +73,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 + "testpipeline", "", "", outdir=test_pipeline_dir, no_git=True, plain=True ) create_obj.init_pipeline() os.remove(os.path.join(test_pipeline_dir, "nextflow_schema.json")) diff --git a/tests/test_schema.py b/tests/test_schema.py index 8bd7e88b24..10313c81f3 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -31,7 +31,7 @@ def setUp(self): self.tmp_dir = tempfile.mkdtemp() self.template_dir = os.path.join(self.tmp_dir, "wf") create_obj = nf_core.create.PipelineCreate( - "test_pipeline", "", "", outdir=self.template_dir, no_git=True, plain=True + "testpipeline", "", "", outdir=self.template_dir, no_git=True, plain=True ) create_obj.init_pipeline() diff --git a/tests/test_sync.py b/tests/test_sync.py index b968b64370..0cedf51698 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -25,7 +25,7 @@ class TestModules(unittest.TestCase): def setUp(self): """Create a new pipeline to test""" self.tmp_dir = tempfile.mkdtemp() - self.pipeline_dir = os.path.join(self.tmp_dir, "test_pipeline") + self.pipeline_dir = os.path.join(self.tmp_dir, "testpipeline") default_branch = "master" self.create_obj = nf_core.create.PipelineCreate( "testing", "test pipeline", "tester", outdir=self.pipeline_dir, plain=True, default_branch=default_branch