From 5b2af583743ec3e79bd1cd5bf5ab6a3a6a469c44 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 16 Sep 2024 15:47:35 +0000 Subject: [PATCH 1/5] use global gitignore to prevent confusion --- .gitignore | 1 + tests/.gitignore | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 tests/.gitignore diff --git a/.gitignore b/.gitignore index cf23d41..2d8b6a1 100755 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ yarn-error.log .work/ .nextflow* .nf-test* +tests/.runs/ # Misc .DS_Store diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index 47d9a86..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.runs/ From 002fe436d2b8dcef48a54a7e4ea6177c27dfa010 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 16 Sep 2024 15:47:45 +0000 Subject: [PATCH 2/5] ignor test runs in prettier --- .prettierignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index ed86b81..e88df16 100755 --- a/.prettierignore +++ b/.prettierignore @@ -5,7 +5,7 @@ .nextflow/ .nf-test/ .pytest_cache/ -.test_data/ +tests/.runs/ venv/ .venv/ .vscode/ From 8974c96c3d768d99ce3ec7ebec7c5ece9b28068f Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 16 Sep 2024 15:47:53 +0000 Subject: [PATCH 3/5] fix prettier --- README.md | 77 ++++++++++++++++----------------- docs/MODULE.md | 30 ++++++------- docs/SUBWORKFLOWS.md | 22 +++++----- modules/environment-schema.json | 4 +- 4 files changed, 66 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 37020ca..d549f1e 100644 --- a/README.md +++ b/README.md @@ -18,45 +18,44 @@ primary focus of the library is to provide pre-built processes and processing se technologies and made easily available to pipeline's developers through the `nf-core` framework. -* [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) -* [Developing in `nf-neuro`](#developing-in-nf-neuro) - * [Manual configuration](#manual-configuration) - * [Dependencies](#dependencies) - * [Python environment](#python-environment) - * [Loading the project's environment](#loading-the-projects-environment) - * [Global environment](#global-environment) - * [Working with VS Code](#working-with-vs-code) - * [Configuration via the `devcontainer` :](#configuration-via-the-devcontainer-) -* [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) - * [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) - * [Generate the template](./docs/MODULE.md#generate-the-template) - * [Edit the template](./docs/MODULE.md#edit-the-template) - * [Edit `main.nf`:](./docs/MODULE.md#edit-mainnf) - * [Edit `environment.yml`:](./docs/MODULE.md#edit-environmentyml) - * [Edit `meta.yml`:](./docs/MODULE.md#edit-metayml) - * [Create test cases](./docs/MODULE.md#create-test-cases) - * [Edit `tests/main.nf.test`:](./docs/MODULE.md#edit-testsmainnftest) - * [Edit `tests/nextflow.config`:](./docs/MODULE.md#edit-testsnextflowconfig) - * [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) - * [Lint your code](./docs/MODULE.md#lint-your-code) - * [Submit your PR](./docs/MODULE.md#submit-your-pr) - * [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) - * [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) - * [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) - * [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) - * [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) - * [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) - * [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) - * [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) - * [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) - * [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) - * [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) - * [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) - * [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) -* [Running tests](#running-tests) -* [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) -* [Installing Prettier](#installing-prettier) - +- [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) +- [Developing in `nf-neuro`](#developing-in-nf-neuro) + - [Manual configuration](#manual-configuration) + - [Dependencies](#dependencies) + - [Python environment](#python-environment) + - [Loading the project's environment](#loading-the-projects-environment) + - [Global environment](#global-environment) + - [Working with VS Code](#working-with-vs-code) + - [Configuration via the `devcontainer` :](#configuration-via-the-devcontainer-) +- [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) + - [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) + - [Generate the template](./docs/MODULE.md#generate-the-template) + - [Edit the template](./docs/MODULE.md#edit-the-template) + - [Edit `main.nf`:](./docs/MODULE.md#edit-mainnf) + - [Edit `environment.yml`:](./docs/MODULE.md#edit-environmentyml) + - [Edit `meta.yml`:](./docs/MODULE.md#edit-metayml) + - [Create test cases](./docs/MODULE.md#create-test-cases) + - [Edit `tests/main.nf.test`:](./docs/MODULE.md#edit-testsmainnftest) + - [Edit `tests/nextflow.config`:](./docs/MODULE.md#edit-testsnextflowconfig) + - [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) + - [Lint your code](./docs/MODULE.md#lint-your-code) + - [Submit your PR](./docs/MODULE.md#submit-your-pr) + - [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) + - [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) + - [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) + - [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) + - [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) + - [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) + - [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) + - [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) + - [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) + - [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) + - [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) + - [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) + - [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) +- [Running tests](#running-tests) +- [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) +- [Installing Prettier](#installing-prettier) # Using modules from `nf-neuro` diff --git a/docs/MODULE.md b/docs/MODULE.md index 0762daf..8b7544e 100755 --- a/docs/MODULE.md +++ b/docs/MODULE.md @@ -1,19 +1,19 @@ # Contributing to nf-neuro -* [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) - * [Generate the template](#generate-the-template) - * [Edit the template](#edit-the-template) - * [Edit `main.nf`:](#edit-mainnf) - * [Edit `environment.yml`:](#edit-environmentyml) - * [Edit `meta.yml`:](#edit-metayml) - * [Create test cases](#create-test-cases) - * [Edit `tests/main.nf.test`:](#edit-testsmainnftest) - * [Edit `tests/nextflow.config`:](#edit-testsnextflowconfig) - * [Generate tests snapshots](#generate-tests-snapshots) - * [Lint your code](#lint-your-code) - * [Submit your PR](#submit-your-pr) -* [Defining optional input parameters](#defining-optional-input-parameters) -* [Test data infrastructure](#test-data-infrastructure) +- [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) + - [Generate the template](#generate-the-template) + - [Edit the template](#edit-the-template) + - [Edit `main.nf`:](#edit-mainnf) + - [Edit `environment.yml`:](#edit-environmentyml) + - [Edit `meta.yml`:](#edit-metayml) + - [Create test cases](#create-test-cases) + - [Edit `tests/main.nf.test`:](#edit-testsmainnftest) + - [Edit `tests/nextflow.config`:](#edit-testsnextflowconfig) + - [Generate tests snapshots](#generate-tests-snapshots) + - [Lint your code](#lint-your-code) + - [Submit your PR](#submit-your-pr) +- [Defining optional input parameters](#defining-optional-input-parameters) +- [Test data infrastructure](#test-data-infrastructure) # Adding a new module to nf-neuro @@ -316,7 +316,7 @@ nf-core modules test -u / ``` All the test case you defined will be run, watch out for errors ! Once everything runs -smoothly, look at the snapshot file produced at `tests/main.nf.test.snap` in your module's +smoothly, look at the snapshot file produced at `tests/main.nf.test.snap` in your module's directory and validate that ALL outputs produced by test cases are caught. Their `md5sum` is critical to ensure future executions of your test produce valid outputs. diff --git a/docs/SUBWORKFLOWS.md b/docs/SUBWORKFLOWS.md index 1a31ab6..fb4e2ce 100644 --- a/docs/SUBWORKFLOWS.md +++ b/docs/SUBWORKFLOWS.md @@ -1,16 +1,16 @@ # Contributing to nf-neuro -* [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) - * [Generate the template](#generate-the-template) - * [Edit the template](#edit-the-template) - * [Edit `main.nf`](#edit-mainnf) - * [Define your subworkflow inputs](#define-your-subworkflow-inputs) - * [Fill the `main:` section](#fill-the-main-section) - * [Define your Workflow outputs](#define-your-workflow-outputs) - * [Edit `meta.yml`](#edit-metayml) - * [Create test cases](#create-test-cases) - * [Lint your code](#lint-your-code) - * [Submit your PR](#submit-your-pr) +- [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) + - [Generate the template](#generate-the-template) + - [Edit the template](#edit-the-template) + - [Edit `main.nf`](#edit-mainnf) + - [Define your subworkflow inputs](#define-your-subworkflow-inputs) + - [Fill the `main:` section](#fill-the-main-section) + - [Define your Workflow outputs](#define-your-workflow-outputs) + - [Edit `meta.yml`](#edit-metayml) + - [Create test cases](#create-test-cases) + - [Lint your code](#lint-your-code) + - [Submit your PR](#submit-your-pr) # Adding a new subworkflow to nf-neuro diff --git a/modules/environment-schema.json b/modules/environment-schema.json index b4499f6..b486b82 100644 --- a/modules/environment-schema.json +++ b/modules/environment-schema.json @@ -11,8 +11,8 @@ "channels": { "type": "array", "items": { - "type": "string" - } + "type": "string" + } }, "dependencies": { "type": "array", From af661954423499d2a82cb87061a560445307289b Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 16 Sep 2024 16:16:25 +0000 Subject: [PATCH 4/5] configure editorconfig-checker to scope better. Fix problems, update readme. --- .editorconfig | 8 ++++ .editorconfig-checker.json | 24 +++++++++++ README.md | 85 ++++++++++++++++++++------------------ docs/MODULE.md | 70 ++++++++++++++++--------------- docs/SUBWORKFLOWS.md | 31 ++++++++------ nf-test.config | 2 +- tests/nextflow.config | 2 +- 7 files changed, 134 insertions(+), 88 deletions(-) create mode 100644 .editorconfig-checker.json diff --git a/.editorconfig b/.editorconfig index a3fe9ab..17a9772 100755 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,11 @@ indent_size = 2 [LICENSE] indent_size = unset + +[tests/.runs] +charset = unset +end_of_line = unset +insert_final_newline = unset +trim_trailing_whitespace = unset +indent_style = unset +indent_size = unset diff --git a/.editorconfig-checker.json b/.editorconfig-checker.json new file mode 100644 index 0000000..e508d89 --- /dev/null +++ b/.editorconfig-checker.json @@ -0,0 +1,24 @@ +{ + "Verbose": true, + "Debug": false, + "IgnoreDefaults": false, + "SpacesAftertabs": false, + "NoColor": false, + "Exclude": [ + "^tests/.runs/", + "^\\.nf-test/", + "^\\.venv/", + "^\\node_modules/", + "\\.nf-test.log$" + ], + "AllowedContentTypes": [], + "PassedFiles": [], + "Disable": { + "EndOfLine": false, + "Indentation": false, + "IndentSize": false, + "InsertFinalNewline": false, + "TrimTrailingWhitespace": false, + "MaxLineLength": false + } +} diff --git a/README.md b/README.md index d549f1e..b0ad013 100644 --- a/README.md +++ b/README.md @@ -18,44 +18,45 @@ primary focus of the library is to provide pre-built processes and processing se technologies and made easily available to pipeline's developers through the `nf-core` framework. -- [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) -- [Developing in `nf-neuro`](#developing-in-nf-neuro) - - [Manual configuration](#manual-configuration) - - [Dependencies](#dependencies) - - [Python environment](#python-environment) - - [Loading the project's environment](#loading-the-projects-environment) - - [Global environment](#global-environment) - - [Working with VS Code](#working-with-vs-code) - - [Configuration via the `devcontainer` :](#configuration-via-the-devcontainer-) -- [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) - - [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) - - [Generate the template](./docs/MODULE.md#generate-the-template) - - [Edit the template](./docs/MODULE.md#edit-the-template) - - [Edit `main.nf`:](./docs/MODULE.md#edit-mainnf) - - [Edit `environment.yml`:](./docs/MODULE.md#edit-environmentyml) - - [Edit `meta.yml`:](./docs/MODULE.md#edit-metayml) - - [Create test cases](./docs/MODULE.md#create-test-cases) - - [Edit `tests/main.nf.test`:](./docs/MODULE.md#edit-testsmainnftest) - - [Edit `tests/nextflow.config`:](./docs/MODULE.md#edit-testsnextflowconfig) - - [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) - - [Lint your code](./docs/MODULE.md#lint-your-code) - - [Submit your PR](./docs/MODULE.md#submit-your-pr) - - [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) - - [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) - - [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) - - [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) - - [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) - - [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) - - [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) - - [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) - - [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) - - [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) - - [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) - - [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) - - [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) -- [Running tests](#running-tests) -- [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) -- [Installing Prettier](#installing-prettier) +* [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) +* [Developing in `nf-neuro`](#developing-in-nf-neuro) + * [Manual configuration](#manual-configuration) + * [Dependencies](#dependencies) + * [Python environment](#python-environment) + * [Loading the project's environment](#loading-the-projects-environment) + * [Global environment](#global-environment) + * [Working with VS Code](#working-with-vs-code) + * [Configuration via the `devcontainer`](#configuration-via-the-devcontainer) +* [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) + * [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) + * [Generate the template](./docs/MODULE.md#generate-the-template) + * [Edit the template](./docs/MODULE.md#edit-the-template) + * [Edit `main.nf`](./docs/MODULE.md#edit-mainnf) + * [Edit `environment.yml`](./docs/MODULE.md#edit-environmentyml) + * [Edit `meta.yml`](./docs/MODULE.md#edit-metayml) + * [Create test cases](./docs/MODULE.md#create-test-cases) + * [Edit `tests/main.nf.test`](./docs/MODULE.md#edit-testsmainnftest) + * [Edit `tests/nextflow.config`](./docs/MODULE.md#edit-testsnextflowconfig) + * [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) + * [Lint your code](./docs/MODULE.md#lint-your-code) + * [Submit your PR](./docs/MODULE.md#submit-your-pr) + * [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) + * [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) + * [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) + * [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) + * [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) + * [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) + * [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) + * [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) + * [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) + * [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) + * [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) + * [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) + * [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) +* [Running tests](#running-tests) +* [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) +* [Installing Prettier and editorconfig](#installing-prettier-and-editorconfig) + # Using modules from `nf-neuro` @@ -187,7 +188,7 @@ This will make it so the `nf-core` commands target the right repository by defau The `nf-neuro` project curates a bundle of useful extensions for Visual Studio Code, the `nf-neuro-extensions` package. You can find it easily on the [extension marketplace](https://marketplace.visualstudio.com/items?itemName=nf-neuro.nf-neuro-extensions). -## Configuration via the `devcontainer` : +## Configuration via the `devcontainer` The `devcontainer` definition for the project contains all required dependencies and setup steps are automatically executed. To use this installation method, you need to have **Docker** (refer to [this section](#configuring-docker-for-easy-usage) for configuration requirements or validate your configuration) and **Visual Studio Code** installed on your system. @@ -238,9 +239,9 @@ sudo usermod -aG docker $USER After running this command, you need to log out and log back in to apply the changes. -# Installing Prettier +# Installing Prettier and editorconfig -To install **Prettier** for the project, you need to have `node` and `npm` installed on your system to at least version 14. On Ubuntu, you can do it using snap : +To install **Prettier** and **editorconfig** for the project, you need to have `node` and `npm` installed on your system to at least version 14. On Ubuntu, you can do it using snap : ```bash sudo snap install node --classic @@ -255,6 +256,8 @@ curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - &&\ apt-get install -y nodejs npm install --save-dev --save-exact prettier +npm install --save-dev --save-exact editorconfig-checker echo "function prettier() { npm exec prettier $@; }" >> ~/.bashrc +echo "function editorconfig-checker() { npm exec editorconfig-checker $@; }" >> ~/.bashrc ``` diff --git a/docs/MODULE.md b/docs/MODULE.md index 8b7544e..724dd04 100755 --- a/docs/MODULE.md +++ b/docs/MODULE.md @@ -1,19 +1,19 @@ # Contributing to nf-neuro -- [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) - - [Generate the template](#generate-the-template) - - [Edit the template](#edit-the-template) - - [Edit `main.nf`:](#edit-mainnf) - - [Edit `environment.yml`:](#edit-environmentyml) - - [Edit `meta.yml`:](#edit-metayml) - - [Create test cases](#create-test-cases) - - [Edit `tests/main.nf.test`:](#edit-testsmainnftest) - - [Edit `tests/nextflow.config`:](#edit-testsnextflowconfig) - - [Generate tests snapshots](#generate-tests-snapshots) - - [Lint your code](#lint-your-code) - - [Submit your PR](#submit-your-pr) -- [Defining optional input parameters](#defining-optional-input-parameters) -- [Test data infrastructure](#test-data-infrastructure) +* [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) + * [Generate the template](#generate-the-template) + * [Edit the template](#edit-the-template) + * [Edit `main.nf`](#edit-mainnf) + * [Edit `environment.yml`](#edit-environmentyml) + * [Edit `meta.yml`](#edit-metayml) + * [Create test cases](#create-test-cases) + * [Edit `tests/main.nf.test`](#edit-testsmainnftest) + * [Edit `tests/nextflow.config`](#edit-testsnextflowconfig) + * [Generate tests snapshots](#generate-tests-snapshots) + * [Lint your code](#lint-your-code) + * [Submit your PR](#submit-your-pr) +* [Defining optional input parameters](#defining-optional-input-parameters) +* [Test data infrastructure](#test-data-infrastructure) # Adding a new module to nf-neuro @@ -57,7 +57,7 @@ already follow all guidelines. You will find related files in : - `modules/nf-neuro/betcrop/fslbetcrop` - `tests/modules/nf-neuro/betcrop/fslbetcrop` -### Edit `main.nf`: +### Edit `main.nf` - Remove the line `conda "YOUR-TOOL-HERE"`. @@ -148,24 +148,19 @@ already follow all guidelines. You will find related files in : - Call `touch ` to generate empty files for all required outputs. -### Edit `environment.yml`: +### Edit `environment.yml` -Start by removing the comments added automatically by `nf-core`, then, replace the existing `channels` section by: +This file is used by `nf-core` to manage `conda` environements for modules. It is not +used by `nf-neuro` for now, but must be created following a basic format for linting to +pass. The file should contain the following : -```yml -channels: - - Docker - - Apptainer +```yaml +name: _ +channels: [] +dependencies: [] ``` -and add the name of the tools used within your module in the `dependencies` section. For example, if you are using `scilpy` tools, write: - -```yml -dependencies: - - scilpy -``` - -### Edit `meta.yml`: +### Edit `meta.yml` Fill the sections you find relevant. There is a lot of metadata in this file, but we don't need to specify them all. At least define the `keywords`, describe the process' @@ -189,7 +184,7 @@ The module's test infrastructure is auto-generated when creating a module using > [!NOTE] > Multiple tests can be specified one after the other in the `main.nf.test`, be sure to corner most of the use-case of your module to ensure catching any potential bugs! -### Edit `tests/main.nf.test`: +### Edit `tests/main.nf.test` To specify test data, you need to define a `setup` section before the actual test definition. This setup section will use the `LOAD_TEST_DATA` workflow to fetch your test data from an available package (refer to [this section](#test-data-infrastructure) to learn how to find packages). Once you selected the archives and files you need, add a `setup` section before the test section. @@ -295,7 +290,7 @@ Finally, ensure all the tags at the beginning of the process definition include Make sure there is no more comments generated by the `nf-core` template, and you should be good to go! -### Edit `tests/nextflow.config`: +### Edit `tests/nextflow.config` The `nextflow.config` file does not exist by default, so you will have to create it if needed. This is not mandatory, except if you have defined optional parameters with `task.ext` and want to alter their values for some test cases. Refer to [this section](#defining-optional-input-parameters) to see how to scope those parameters to specific tests using `selectors`. @@ -322,13 +317,22 @@ critical to ensure future executions of your test produce valid outputs. ## Lint your code -Before submitting to _nf-neuro_, once you've commit and push everything, the code need to be correctly linted, else the checks won't pass. This is done using `prettier` on your new module, through the _nf-core_ command line : +Before submitting to _nf-neuro_, once you've commit and push everything, the code need to be correctly linted, else the checks won't pass. This is done using `prettier` and `editorconfig-checker` on your new module, through the _nf-core_ command line : ```bash nf-core modules lint / ``` -You'll probably get a bunch of _whitespace_ and _indentation_ errors, but also image errors, bad _nextflow_ syntax and more. You need to fix all `errors` and as much as the `warnings`as possible. +You'll probably get a bunch of _whitespace_ and _indentation_ errors, but also image errors, bad _nextflow_ syntax and more. You need to fix all `errors` and as much as the `warnings` as possible. + +If at any point you modified files outside of your module's directory, those also need to be linted. To do so, run the following commands at the root of the repository : + +```bash +prettier --check . +editorconfig-checker +``` + +You'll get lists of syntax errors to fix from both commands. For prettier, you can run `prettier --write .` to fix most of them automatically. For `editorconfig-checker`, you'll have to fix them manually. ## Submit your PR diff --git a/docs/SUBWORKFLOWS.md b/docs/SUBWORKFLOWS.md index fb4e2ce..4cd8b47 100644 --- a/docs/SUBWORKFLOWS.md +++ b/docs/SUBWORKFLOWS.md @@ -1,16 +1,16 @@ # Contributing to nf-neuro -- [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) - - [Generate the template](#generate-the-template) - - [Edit the template](#edit-the-template) - - [Edit `main.nf`](#edit-mainnf) - - [Define your subworkflow inputs](#define-your-subworkflow-inputs) - - [Fill the `main:` section](#fill-the-main-section) - - [Define your Workflow outputs](#define-your-workflow-outputs) - - [Edit `meta.yml`](#edit-metayml) - - [Create test cases](#create-test-cases) - - [Lint your code](#lint-your-code) - - [Submit your PR](#submit-your-pr) +* [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) + * [Generate the template](#generate-the-template) + * [Edit the template](#edit-the-template) + * [Edit `main.nf`](#edit-mainnf) + * [Define your subworkflow inputs](#define-your-subworkflow-inputs) + * [Fill the `main:` section](#fill-the-main-section) + * [Define your Workflow outputs](#define-your-workflow-outputs) + * [Edit `meta.yml`](#edit-metayml) + * [Create test cases](#create-test-cases) + * [Lint your code](#lint-your-code) + * [Submit your PR](#submit-your-pr) # Adding a new subworkflow to nf-neuro @@ -152,7 +152,14 @@ Run `prettier` on your new module, through the `nf-core` command line : nf-core subworkflows lint ``` -and fix all `errors` and as many `warnings` as possible. +and fix all `errors` and as many `warnings` as possible. If at any point you modified files outside of your module's directory, those also need to be linted. To do so, run the following commands at the root of the repository : + +```bash +prettier --check . +editorconfig-checker +``` + +You'll get lists of syntax errors to fix from both commands. For prettier, you can run `prettier --write .` to fix most of them automatically. For `editorconfig-checker`, you'll have to fix them manually. ## Submit your PR diff --git a/nf-test.config b/nf-test.config index ea98474..9a5e2a8 100755 --- a/nf-test.config +++ b/nf-test.config @@ -10,7 +10,7 @@ config { ignore ".venv/**/*.nf*" - requires( + requires( "nf-test": "0.9.0" ) diff --git a/tests/nextflow.config b/tests/nextflow.config index 2cc9a5f..05a0368 100644 --- a/tests/nextflow.config +++ b/tests/nextflow.config @@ -18,4 +18,4 @@ report { overwrite = true } -includeConfig "$projectDir/tests/config/nextflow.config" \ No newline at end of file +includeConfig "$projectDir/tests/config/nextflow.config" From f30020eb8a9d581026aee25544d1dfcdf51fd07e Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 16 Sep 2024 17:14:14 +0000 Subject: [PATCH 5/5] re-run prettier --- .editorconfig-checker.json | 8 +--- README.md | 77 +++++++++++++++++++------------------- docs/MODULE.md | 28 +++++++------- docs/SUBWORKFLOWS.md | 22 +++++------ 4 files changed, 64 insertions(+), 71 deletions(-) diff --git a/.editorconfig-checker.json b/.editorconfig-checker.json index e508d89..5724fe8 100644 --- a/.editorconfig-checker.json +++ b/.editorconfig-checker.json @@ -4,13 +4,7 @@ "IgnoreDefaults": false, "SpacesAftertabs": false, "NoColor": false, - "Exclude": [ - "^tests/.runs/", - "^\\.nf-test/", - "^\\.venv/", - "^\\node_modules/", - "\\.nf-test.log$" - ], + "Exclude": ["^tests/.runs/", "^\\.nf-test/", "^\\.venv/", "^\\node_modules/", "\\.nf-test.log$"], "AllowedContentTypes": [], "PassedFiles": [], "Disable": { diff --git a/README.md b/README.md index b0ad013..dea59dc 100644 --- a/README.md +++ b/README.md @@ -18,45 +18,44 @@ primary focus of the library is to provide pre-built processes and processing se technologies and made easily available to pipeline's developers through the `nf-core` framework. -* [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) -* [Developing in `nf-neuro`](#developing-in-nf-neuro) - * [Manual configuration](#manual-configuration) - * [Dependencies](#dependencies) - * [Python environment](#python-environment) - * [Loading the project's environment](#loading-the-projects-environment) - * [Global environment](#global-environment) - * [Working with VS Code](#working-with-vs-code) - * [Configuration via the `devcontainer`](#configuration-via-the-devcontainer) -* [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) - * [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) - * [Generate the template](./docs/MODULE.md#generate-the-template) - * [Edit the template](./docs/MODULE.md#edit-the-template) - * [Edit `main.nf`](./docs/MODULE.md#edit-mainnf) - * [Edit `environment.yml`](./docs/MODULE.md#edit-environmentyml) - * [Edit `meta.yml`](./docs/MODULE.md#edit-metayml) - * [Create test cases](./docs/MODULE.md#create-test-cases) - * [Edit `tests/main.nf.test`](./docs/MODULE.md#edit-testsmainnftest) - * [Edit `tests/nextflow.config`](./docs/MODULE.md#edit-testsnextflowconfig) - * [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) - * [Lint your code](./docs/MODULE.md#lint-your-code) - * [Submit your PR](./docs/MODULE.md#submit-your-pr) - * [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) - * [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) - * [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) - * [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) - * [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) - * [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) - * [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) - * [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) - * [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) - * [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) - * [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) - * [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) - * [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) -* [Running tests](#running-tests) -* [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) -* [Installing Prettier and editorconfig](#installing-prettier-and-editorconfig) - +- [Using modules from `nf-neuro`](#using-modules-from-nf-neuro) +- [Developing in `nf-neuro`](#developing-in-nf-neuro) + - [Manual configuration](#manual-configuration) + - [Dependencies](#dependencies) + - [Python environment](#python-environment) + - [Loading the project's environment](#loading-the-projects-environment) + - [Global environment](#global-environment) + - [Working with VS Code](#working-with-vs-code) + - [Configuration via the `devcontainer`](#configuration-via-the-devcontainer) +- [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project) + - [Adding a new module to nf-neuro](./docs/MODULE.md#adding-a-new-module-to-nf-neuro) + - [Generate the template](./docs/MODULE.md#generate-the-template) + - [Edit the template](./docs/MODULE.md#edit-the-template) + - [Edit `main.nf`](./docs/MODULE.md#edit-mainnf) + - [Edit `environment.yml`](./docs/MODULE.md#edit-environmentyml) + - [Edit `meta.yml`](./docs/MODULE.md#edit-metayml) + - [Create test cases](./docs/MODULE.md#create-test-cases) + - [Edit `tests/main.nf.test`](./docs/MODULE.md#edit-testsmainnftest) + - [Edit `tests/nextflow.config`](./docs/MODULE.md#edit-testsnextflowconfig) + - [Generate tests snapshots](./docs/MODULE.md#generate-tests-snapshots) + - [Lint your code](./docs/MODULE.md#lint-your-code) + - [Submit your PR](./docs/MODULE.md#submit-your-pr) + - [Defining optional input parameters](./docs/MODULE.md#defining-optional-input-parameters) + - [Test data infrastructure](./docs/MODULE.md#test-data-infrastructure) + - [Adding a new subworkflow to nf-neuro](./docs/SUBWORKFLOWS.md#adding-a-new-subworkflow-to-nf-neuro) + - [Generate the template](./docs/SUBWORKFLOWS.md#generate-the-template) + - [Edit the template](./docs/SUBWORKFLOWS.md#edit-the-template) + - [Edit `main.nf`](./docs/SUBWORKFLOWS.md#edit-mainnf) + - [Define your subworkflow inputs](./docs/SUBWORKFLOWS.md#define-your-subworkflow-inputs) + - [Fill the `main:` section](./docs/SUBWORKFLOWS.md#fill-the-main-section) + - [Define your Workflow outputs](./docs/SUBWORKFLOWS.md#define-your-workflow-outputs) + - [Edit `meta.yml`](./docs/SUBWORKFLOWS.md#edit-metayml) + - [Create test cases](./docs/SUBWORKFLOWS.md#create-test-cases) + - [Lint your code](./docs/SUBWORKFLOWS.md#lint-your-code) + - [Submit your PR](./docs/SUBWORKFLOWS.md#submit-your-pr) +- [Running tests](#running-tests) +- [Configuring Docker for easy usage](#configuring-docker-for-easy-usage) +- [Installing Prettier and editorconfig](#installing-prettier-and-editorconfig) # Using modules from `nf-neuro` diff --git a/docs/MODULE.md b/docs/MODULE.md index 724dd04..93fe53b 100755 --- a/docs/MODULE.md +++ b/docs/MODULE.md @@ -1,19 +1,19 @@ # Contributing to nf-neuro -* [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) - * [Generate the template](#generate-the-template) - * [Edit the template](#edit-the-template) - * [Edit `main.nf`](#edit-mainnf) - * [Edit `environment.yml`](#edit-environmentyml) - * [Edit `meta.yml`](#edit-metayml) - * [Create test cases](#create-test-cases) - * [Edit `tests/main.nf.test`](#edit-testsmainnftest) - * [Edit `tests/nextflow.config`](#edit-testsnextflowconfig) - * [Generate tests snapshots](#generate-tests-snapshots) - * [Lint your code](#lint-your-code) - * [Submit your PR](#submit-your-pr) -* [Defining optional input parameters](#defining-optional-input-parameters) -* [Test data infrastructure](#test-data-infrastructure) +- [Adding a new module to nf-neuro](#adding-a-new-module-to-nf-neuro) + - [Generate the template](#generate-the-template) + - [Edit the template](#edit-the-template) + - [Edit `main.nf`](#edit-mainnf) + - [Edit `environment.yml`](#edit-environmentyml) + - [Edit `meta.yml`](#edit-metayml) + - [Create test cases](#create-test-cases) + - [Edit `tests/main.nf.test`](#edit-testsmainnftest) + - [Edit `tests/nextflow.config`](#edit-testsnextflowconfig) + - [Generate tests snapshots](#generate-tests-snapshots) + - [Lint your code](#lint-your-code) + - [Submit your PR](#submit-your-pr) +- [Defining optional input parameters](#defining-optional-input-parameters) +- [Test data infrastructure](#test-data-infrastructure) # Adding a new module to nf-neuro diff --git a/docs/SUBWORKFLOWS.md b/docs/SUBWORKFLOWS.md index 4cd8b47..9f1c2cb 100644 --- a/docs/SUBWORKFLOWS.md +++ b/docs/SUBWORKFLOWS.md @@ -1,16 +1,16 @@ # Contributing to nf-neuro -* [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) - * [Generate the template](#generate-the-template) - * [Edit the template](#edit-the-template) - * [Edit `main.nf`](#edit-mainnf) - * [Define your subworkflow inputs](#define-your-subworkflow-inputs) - * [Fill the `main:` section](#fill-the-main-section) - * [Define your Workflow outputs](#define-your-workflow-outputs) - * [Edit `meta.yml`](#edit-metayml) - * [Create test cases](#create-test-cases) - * [Lint your code](#lint-your-code) - * [Submit your PR](#submit-your-pr) +- [Adding a new subworkflow to nf-neuro](#adding-a-new-subworkflow-to-nf-neuro) + - [Generate the template](#generate-the-template) + - [Edit the template](#edit-the-template) + - [Edit `main.nf`](#edit-mainnf) + - [Define your subworkflow inputs](#define-your-subworkflow-inputs) + - [Fill the `main:` section](#fill-the-main-section) + - [Define your Workflow outputs](#define-your-workflow-outputs) + - [Edit `meta.yml`](#edit-metayml) + - [Create test cases](#create-test-cases) + - [Lint your code](#lint-your-code) + - [Submit your PR](#submit-your-pr) # Adding a new subworkflow to nf-neuro