From a4c829fb909f060f3c5d35486a7b293c2161757f Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 29 Jul 2024 12:40:04 +0200 Subject: [PATCH 1/4] add option to skip code linters --- .../create-test-lint-wf-template.yml | 5 + nf_core/pipeline-template/.gitpod.yml | 3 +- nf_core/pipelines/create/create.py | 8 + nf_core/pipelines/create/custompipeline.py | 16 + tests/__snapshots__/test_create_app.ambr | 511 +++++++++--------- tests/data/pipeline_create_template_skip.yml | 1 + tests/test_create.py | 14 +- 7 files changed, 296 insertions(+), 262 deletions(-) diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index b823ca72d8..cfa0a50079 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -41,6 +41,7 @@ jobs: - "template_skip_github_badges.yml" - "template_skip_igenomes.yml" - "template_skip_ci.yml" + - "template_skip_code_linters.yml" runner: # use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default - ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }} @@ -102,6 +103,10 @@ jobs: run: | printf "org: my-prefix\nskip: nf_core_configs" > create-test-lint-wf/template_skip_nf_core_configs.yml + - name: Create template skip code_linters + run: | + printf "org: my-prefix\nskip: code_linters" > create-test-lint-wf/template_skip_code_linters.yml + # Create a pipeline from the template - name: create a pipeline from the template ${{ matrix.TEMPLATE }} run: | diff --git a/nf_core/pipeline-template/.gitpod.yml b/nf_core/pipeline-template/.gitpod.yml index 105a1821a1..30e85ed977 100644 --- a/nf_core/pipeline-template/.gitpod.yml +++ b/nf_core/pipeline-template/.gitpod.yml @@ -10,8 +10,9 @@ tasks: vscode: extensions: # based on nf-core.nf-core-extensionpack + #{%- if code_linters -%} - esbenp.prettier-vscode # Markdown/CommonMark linting and style checking for Visual Studio Code - - EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files + - EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files{% endif %} - Gruntfuggly.todo-tree # Display TODO and FIXME in a tree view in the activity bar - mechatroner.rainbow-csv # Highlight columns in csv files in different colors # - nextflow.nextflow # Nextflow syntax highlighting diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index 27ca8ac847..42e4a6ad7b 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -94,6 +94,13 @@ def __init__( ".github/workflows/awstest.yml", ".github/workflows/release-announcements.yml", ], + "code_linters": [ + ".editorconfig", + ".pre-commit-config.yaml", + ".prettierignore", + ".prettierrc.yml", + ".github/workflows/fix-linting.yml", + ], } # Get list of files we're skipping with the supplied skip keys self.skip_paths = set(sp for k in skip_paths for sp in skippable_paths[k]) @@ -202,6 +209,7 @@ def obtain_jinja_params_dict(self, features_to_skip, pipeline_dir): "github_badges": {"file": False, "content": True}, "igenomes": {"file": True, "content": True}, "nf_core_configs": {"file": False, "content": True}, + "code_linters": {"file": True, "content": True}, } # Set the parameters for the jinja template diff --git a/nf_core/pipelines/create/custompipeline.py b/nf_core/pipelines/create/custompipeline.py index 7d460db65d..7a94ab228a 100644 --- a/nf_core/pipelines/create/custompipeline.py +++ b/nf_core/pipelines/create/custompipeline.py @@ -41,6 +41,16 @@ For more information about nf-core configuration profiles, see the [nf-core/configs repository](https://github.com/nf-core/configs) """ +markdown_code_linters = """ +Pipelines include code linters, these linters will check the formatting of your code. +Linters will check JSON, YAML, Python and others. +The available code linters are: + +- pre-commit (https://pre-commit.com/): used to run all code-linters on every PR and on ever commit if you run `pre-commit install` to install it in your local repository. +- editor-config (https://github.com/editorconfig-checker/editorconfig-checker): checks rules such as indentation or trailing spaces. +- prettier (https://github.com/prettier/prettier): enforces a consistent style (indentation, quoting, line length, etc). +""" + class CustomPipeline(Screen): """Select if the pipeline will use genomic data.""" @@ -80,6 +90,12 @@ def compose(self) -> ComposeResult: "The pipeline will include configuration profiles containing custom parameters requried to run nf-core pipelines at different institutions", "nf_core_configs", ), + PipelineFeature( + markdown_code_linters, + "Use code linters", + "The pipeline will include code linters and CI tests to lint your code: pre-commit, editor-config and prettier.", + "code_linters", + ), classes="features-container", ) yield Center( diff --git a/tests/__snapshots__/test_create_app.ambr b/tests/__snapshots__/test_create_app.ambr index 2ad0772587..5e5b005de0 100644 --- a/tests/__snapshots__/test_create_app.ambr +++ b/tests/__snapshots__/test_create_app.ambr @@ -851,257 +851,257 @@ font-weight: 700; } - .terminal-2971485804-matrix { + .terminal-2778615119-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2971485804-title { + .terminal-2778615119-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2971485804-r1 { fill: #c5c8c6 } - .terminal-2971485804-r2 { fill: #e3e3e3 } - .terminal-2971485804-r3 { fill: #989898 } - .terminal-2971485804-r4 { fill: #e1e1e1 } - .terminal-2971485804-r5 { fill: #4ebf71;font-weight: bold } - .terminal-2971485804-r6 { fill: #1e1e1e } - .terminal-2971485804-r7 { fill: #0178d4 } - .terminal-2971485804-r8 { fill: #454a50 } - .terminal-2971485804-r9 { fill: #e2e2e2 } - .terminal-2971485804-r10 { fill: #808080 } - .terminal-2971485804-r11 { fill: #e2e3e3;font-weight: bold } - .terminal-2971485804-r12 { fill: #000000 } - .terminal-2971485804-r13 { fill: #e4e4e4 } - .terminal-2971485804-r14 { fill: #14191f } - .terminal-2971485804-r15 { fill: #507bb3 } - .terminal-2971485804-r16 { fill: #dde6ed;font-weight: bold } - .terminal-2971485804-r17 { fill: #001541 } - .terminal-2971485804-r18 { fill: #7ae998 } - .terminal-2971485804-r19 { fill: #0a180e;font-weight: bold } - .terminal-2971485804-r20 { fill: #008139 } - .terminal-2971485804-r21 { fill: #fea62b;font-weight: bold } - .terminal-2971485804-r22 { fill: #a7a9ab } - .terminal-2971485804-r23 { fill: #e2e3e3 } + .terminal-2778615119-r1 { fill: #c5c8c6 } + .terminal-2778615119-r2 { fill: #e3e3e3 } + .terminal-2778615119-r3 { fill: #989898 } + .terminal-2778615119-r4 { fill: #e1e1e1 } + .terminal-2778615119-r5 { fill: #4ebf71;font-weight: bold } + .terminal-2778615119-r6 { fill: #1e1e1e } + .terminal-2778615119-r7 { fill: #0178d4 } + .terminal-2778615119-r8 { fill: #454a50 } + .terminal-2778615119-r9 { fill: #e2e2e2 } + .terminal-2778615119-r10 { fill: #808080 } + .terminal-2778615119-r11 { fill: #e2e3e3;font-weight: bold } + .terminal-2778615119-r12 { fill: #000000 } + .terminal-2778615119-r13 { fill: #e4e4e4 } + .terminal-2778615119-r14 { fill: #14191f } + .terminal-2778615119-r15 { fill: #507bb3 } + .terminal-2778615119-r16 { fill: #dde6ed;font-weight: bold } + .terminal-2778615119-r17 { fill: #001541 } + .terminal-2778615119-r18 { fill: #7ae998 } + .terminal-2778615119-r19 { fill: #0a180e;font-weight: bold } + .terminal-2778615119-r20 { fill: #008139 } + .terminal-2778615119-r21 { fill: #fea62b;font-weight: bold } + .terminal-2778615119-r22 { fill: #a7a9ab } + .terminal-2778615119-r23 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core create + nf-core create - - - - nf-core create — Create a new pipeline with the nf-core pipeline template - - - Template features - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Use reference The pipeline will  Hide help  - ▁▁▁▁▁▁▁▁        genomesbe configured to ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - use a copy of the  - most common  - reference genome  - files from  - iGenomes - - - Nf-core pipelines are configured to use a copy of the most common  - reference genome files. - - By selecting this option, your pipeline will include a configuration - file specifying the paths to these files. - - The required code to use these files will also be included in the  - template. When the pipeline user provides an appropriate genome key, - the pipeline will automatically download the required reference ▂▂ - files. - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Add Github CI The pipeline will  Show help  - ▁▁▁▁▁▁▁▁        testsinclude several ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - GitHub actions for - Continuous  - Integration (CI)  - testing▄▄ - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Add Github badgesThe README.md file Show help  - ▁▁▁▁▁▁▁▁of the pipeline ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - will include  - GitHub badges - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  Back  Continue  - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - -  d Toggle dark mode  q Quit  + + + + nf-core create — Create a new pipeline with the nf-core pipeline template + + + Template features + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Use reference The pipeline will  Hide help  + ▁▁▁▁▁▁▁▁        genomesbe configured to ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + use a copy of the  + most common  + reference genome  + files from  + iGenomes + + + Nf-core pipelines are configured to use a copy of the most common  + reference genome files. + + By selecting this option, your pipeline will include a configuration + file specifying the paths to these files. + + The required code to use these files will also be included in the  + template. When the pipeline user provides an appropriate genome key, + the pipeline will automatically download the required reference ▂▂ + files. + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Add Github CI The pipeline will  Show help  + ▁▁▁▁▁▁▁▁        testsinclude several ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + GitHub actions for + Continuous  + Integration (CI)  + testing + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Add Github badgesThe README.md file Show help  + ▁▁▁▁▁▁▁▁of the pipeline ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + will include  + GitHub badges + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  Back  Continue  + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + +  d Toggle dark mode  q Quit  @@ -2233,254 +2233,255 @@ font-weight: 700; } - .terminal-1445899181-matrix { + .terminal-763408100-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1445899181-title { + .terminal-763408100-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1445899181-r1 { fill: #c5c8c6 } - .terminal-1445899181-r2 { fill: #e3e3e3 } - .terminal-1445899181-r3 { fill: #989898 } - .terminal-1445899181-r4 { fill: #e1e1e1 } - .terminal-1445899181-r5 { fill: #4ebf71;font-weight: bold } - .terminal-1445899181-r6 { fill: #1e1e1e } - .terminal-1445899181-r7 { fill: #507bb3 } - .terminal-1445899181-r8 { fill: #e2e2e2 } - .terminal-1445899181-r9 { fill: #808080 } - .terminal-1445899181-r10 { fill: #dde6ed;font-weight: bold } - .terminal-1445899181-r11 { fill: #001541 } - .terminal-1445899181-r12 { fill: #454a50 } - .terminal-1445899181-r13 { fill: #7ae998 } - .terminal-1445899181-r14 { fill: #e2e3e3;font-weight: bold } - .terminal-1445899181-r15 { fill: #0a180e;font-weight: bold } - .terminal-1445899181-r16 { fill: #000000 } - .terminal-1445899181-r17 { fill: #008139 } - .terminal-1445899181-r18 { fill: #fea62b;font-weight: bold } - .terminal-1445899181-r19 { fill: #a7a9ab } - .terminal-1445899181-r20 { fill: #e2e3e3 } + .terminal-763408100-r1 { fill: #c5c8c6 } + .terminal-763408100-r2 { fill: #e3e3e3 } + .terminal-763408100-r3 { fill: #989898 } + .terminal-763408100-r4 { fill: #e1e1e1 } + .terminal-763408100-r5 { fill: #4ebf71;font-weight: bold } + .terminal-763408100-r6 { fill: #1e1e1e } + .terminal-763408100-r7 { fill: #507bb3 } + .terminal-763408100-r8 { fill: #e2e2e2 } + .terminal-763408100-r9 { fill: #808080 } + .terminal-763408100-r10 { fill: #dde6ed;font-weight: bold } + .terminal-763408100-r11 { fill: #001541 } + .terminal-763408100-r12 { fill: #14191f } + .terminal-763408100-r13 { fill: #454a50 } + .terminal-763408100-r14 { fill: #7ae998 } + .terminal-763408100-r15 { fill: #e2e3e3;font-weight: bold } + .terminal-763408100-r16 { fill: #0a180e;font-weight: bold } + .terminal-763408100-r17 { fill: #000000 } + .terminal-763408100-r18 { fill: #008139 } + .terminal-763408100-r19 { fill: #fea62b;font-weight: bold } + .terminal-763408100-r20 { fill: #a7a9ab } + .terminal-763408100-r21 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core create + nf-core create - - - - nf-core create — Create a new pipeline with the nf-core pipeline template - - - Template features - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Use reference The pipeline will  Show help  - ▁▁▁▁▁▁▁▁        genomesbe configured to ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - use a copy of the  - most common  - reference genome  - files from iGenomes - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Add Github CI tests        The pipeline will  Show help  - ▁▁▁▁▁▁▁▁include several ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - GitHub actions for  - Continuous  - Integration (CI)  - testing - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Add Github badgesThe README.md file  Show help  - ▁▁▁▁▁▁▁▁of the pipeline ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - will include GitHub - badges - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -         Add configuration The pipeline will  Show help  - ▁▁▁▁▁▁▁▁        filesinclude ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - configuration  - profiles containing - custom parameters  - requried to run  - nf-core pipelines  - at different  - institutions - - - - - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  Back  Continue  - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - -  d Toggle dark mode  q Quit  + + + + nf-core create — Create a new pipeline with the nf-core pipeline template + + + Template features + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Use reference The pipeline will  Show help  + ▁▁▁▁▁▁▁▁        genomesbe configured to ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + use a copy of the  + most common  + reference genome  + files from  + iGenomes + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Add Github CI The pipeline will  Show help  + ▁▁▁▁▁▁▁▁        testsinclude several ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + GitHub actions for + Continuous  + Integration (CI)  + testing + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Add Github badgesThe README.md file Show help  + ▁▁▁▁▁▁▁▁of the pipeline ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + will include  + GitHub badges + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Add configuration         The pipeline will  Show help  + ▁▁▁▁▁▁▁▁        filesinclude ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + configuration  + profiles  + containing custom  + parameters  + requried to run  + nf-core pipelines  + at different ▁▁ + institutions + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +         Use code lintersThe pipeline will  Show help  + ▁▁▁▁▁▁▁▁include code ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  Back  Continue  + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + +  d Toggle dark mode  q Quit  diff --git a/tests/data/pipeline_create_template_skip.yml b/tests/data/pipeline_create_template_skip.yml index ed498cb732..d9ef405c51 100644 --- a/tests/data/pipeline_create_template_skip.yml +++ b/tests/data/pipeline_create_template_skip.yml @@ -11,3 +11,4 @@ skip_features: - github_badges - igenomes - nf_core_configs + - code_linters diff --git a/tests/test_create.py b/tests/test_create.py index 313b6f5354..896a8e7ad6 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -106,14 +106,16 @@ def test_pipeline_creation_with_yml_skip(self, tmp_path): pipeline.init_pipeline() # Check pipeline template yml has been dumped to `.nf-core.yml` and matches input - assert not os.path.exists(os.path.join(pipeline.outdir, "pipeline_template.yml")) - assert os.path.exists(os.path.join(pipeline.outdir, ".nf-core.yml")) - with open(os.path.join(pipeline.outdir, ".nf-core.yml")) as fh: + assert not os.path.exists(Path(pipeline.outdir / "pipeline_template.yml")) + assert os.path.exists(Path(pipeline.outdir / ".nf-core.yml")) + with open(Path(pipeline.outdir / ".nf-core.yml")) as fh: nfcore_yml = yaml.safe_load(fh) assert "template" in nfcore_yml assert yaml.safe_load(PIPELINE_TEMPLATE_YML.read_text()).items() <= nfcore_yml["template"].items() # Check that some of the skipped files are not present - assert not os.path.exists(os.path.join(pipeline.outdir, "CODE_OF_CONDUCT.md")) - assert not os.path.exists(os.path.join(pipeline.outdir, ".github")) - assert not os.path.exists(os.path.join(pipeline.outdir, "conf", "igenomes.config")) + assert not os.path.exists(Path(pipeline.outdir / "CODE_OF_CONDUCT.md")) + assert not os.path.exists(Path(pipeline.outdir / ".github")) + assert not os.path.exists(Path(pipeline.outdir / "conf" / "igenomes.config")) + assert not os.path.exists(Path(pipeline.outdir / ".editorconfig")) + assert not os.path.exists(Path(pipeline.outdir / ".editorconfig")) From a4cf066e3a041be2b05fa67c661f408644bd5327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Mon, 29 Jul 2024 16:41:19 +0200 Subject: [PATCH 2/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- nf_core/pipelines/create/custompipeline.py | 4 ++-- tests/test_create.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/nf_core/pipelines/create/custompipeline.py b/nf_core/pipelines/create/custompipeline.py index 7a94ab228a..0925fb5bab 100644 --- a/nf_core/pipelines/create/custompipeline.py +++ b/nf_core/pipelines/create/custompipeline.py @@ -42,8 +42,8 @@ """ markdown_code_linters = """ -Pipelines include code linters, these linters will check the formatting of your code. -Linters will check JSON, YAML, Python and others. +Pipelines include code linters to check the formatting of your code in order to harmonize code styles between developers. +Linters will check all non-ignored files, e.g., JSON, YAML, Nextlow or Python files in your repository. The available code linters are: - pre-commit (https://pre-commit.com/): used to run all code-linters on every PR and on ever commit if you run `pre-commit install` to install it in your local repository. diff --git a/tests/test_create.py b/tests/test_create.py index 896a8e7ad6..b4ac89c7de 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -118,4 +118,3 @@ def test_pipeline_creation_with_yml_skip(self, tmp_path): assert not os.path.exists(Path(pipeline.outdir / ".github")) assert not os.path.exists(Path(pipeline.outdir / "conf" / "igenomes.config")) assert not os.path.exists(Path(pipeline.outdir / ".editorconfig")) - assert not os.path.exists(Path(pipeline.outdir / ".editorconfig")) From 419242b931ff228fee0babf63d50313b2fbd6ee9 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 29 Jul 2024 16:46:46 +0200 Subject: [PATCH 3/4] use pathlib instead of os.path --- tests/test_create.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_create.py b/tests/test_create.py index b4ac89c7de..920a0f4750 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -106,15 +106,15 @@ def test_pipeline_creation_with_yml_skip(self, tmp_path): pipeline.init_pipeline() # Check pipeline template yml has been dumped to `.nf-core.yml` and matches input - assert not os.path.exists(Path(pipeline.outdir / "pipeline_template.yml")) - assert os.path.exists(Path(pipeline.outdir / ".nf-core.yml")) - with open(Path(pipeline.outdir / ".nf-core.yml")) as fh: + assert not (pipeline.outdir / "pipeline_template.yml").exists() + assert (pipeline.outdir / ".nf-core.yml").exists() + with open(pipeline.outdir / ".nf-core.yml") as fh: nfcore_yml = yaml.safe_load(fh) assert "template" in nfcore_yml assert yaml.safe_load(PIPELINE_TEMPLATE_YML.read_text()).items() <= nfcore_yml["template"].items() # Check that some of the skipped files are not present - assert not os.path.exists(Path(pipeline.outdir / "CODE_OF_CONDUCT.md")) - assert not os.path.exists(Path(pipeline.outdir / ".github")) - assert not os.path.exists(Path(pipeline.outdir / "conf" / "igenomes.config")) - assert not os.path.exists(Path(pipeline.outdir / ".editorconfig")) + assert not (pipeline.outdir / "CODE_OF_CONDUCT.md").exists() + assert not (pipeline.outdir / ".github").exists() + assert not (pipeline.outdir / "conf" / "igenomes.config").exists() + assert not (pipeline.outdir / ".editorconfig").exists() From f5e865086bda88e28523f0757bf4e71366b228ad Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 29 Jul 2024 16:48:44 +0200 Subject: [PATCH 4/4] update chagelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b27dce4b5c..8eae70a311 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Remove deprecated syntax ([#3046](https://github.com/nf-core/tools/pull/3046)) - Use filename in code block for `params.yml` ([#3055](https://github.com/nf-core/tools/pull/3055)) - Remove release announcement for non nf-core pipelines ([#3072](https://github.com/nf-core/tools/pull/3072)) +- add option to exclude code linters for custom pipeline template ([#3084](https://github.com/nf-core/tools/pull/3084)) ### Linting