From cb0d2903f51aa20f6c7aa4db90f3de4ebd07b003 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Wed, 4 Aug 2021 15:48:05 +0200 Subject: [PATCH 01/12] Update lint docs creation script to include modules --- docs/api/make_lint_md.py | 54 +++++++++++++++++++++++++++++++++++++++ docs/api/make_lint_rst.py | 34 ------------------------ 2 files changed, 54 insertions(+), 34 deletions(-) create mode 100644 docs/api/make_lint_md.py delete mode 100644 docs/api/make_lint_rst.py diff --git a/docs/api/make_lint_md.py b/docs/api/make_lint_md.py new file mode 100644 index 0000000000..6b54dc8682 --- /dev/null +++ b/docs/api/make_lint_md.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import fnmatch +import os +import nf_core.lint +import nf_core.modules.lint + + +def make_docs(docs_basedir, lint_tests, md_template): + # Get list of existing .md files + existing_docs = [] + for fn in os.listdir(docs_basedir): + if fnmatch.fnmatch(fn, "*.md") and not fnmatch.fnmatch(fn, "index.md"): + existing_docs.append(os.path.join(docs_basedir, fn)) + + for test_name in lint_tests: + fn = os.path.join(docs_basedir, "{}.md".format(test_name)) + if os.path.exists(fn): + existing_docs.remove(fn) + else: + with open(fn, "w") as fh: + fh.write(md_template.format(test_name)) + + for fn in existing_docs: + os.remove(fn) + + +# Create the pipeline docs +pipeline_docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "pipeline_lint_tests") +make_docs( + pipeline_docs_basedir, + nf_core.lint.PipelineLint._get_all_lint_tests(), + """# {0} + + ```{eval-rst} + .. automethod:: nf_core.lint.PipelineLint.{0} + ``` + + """, +) + +# Create the modules lint docs +modules_docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "modules_lint_tests") +make_docs( + modules_docs_basedir, + nf_core.modules.lint.ModuleLint._get_all_lint_tests(), + """# {0} + + ```{eval-rst} + .. automethod:: nf_core.modules.lint.ModuleLint.{0} + ``` + + """, +) diff --git a/docs/api/make_lint_rst.py b/docs/api/make_lint_rst.py deleted file mode 100644 index 2e80e384ac..0000000000 --- a/docs/api/make_lint_rst.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -import fnmatch -import os -import nf_core.lint - -docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "pipeline_lint_tests") - -# Get list of existing .md files -existing_docs = [] -for fn in os.listdir(docs_basedir): - if fnmatch.fnmatch(fn, "*.md") and not fnmatch.fnmatch(fn, "index.md"): - existing_docs.append(os.path.join(docs_basedir, fn)) - -# Make .md file for each test name -lint_obj = nf_core.lint.PipelineLint("", True) -md_template = """# {0} - -```{eval-rst} -.. automethod:: nf_core.lint.PipelineLint.{0} -``` - -""" - -for test_name in lint_obj.lint_tests: - fn = os.path.join(docs_basedir, "{}.md".format(test_name)) - if os.path.exists(fn): - existing_docs.remove(fn) - else: - with open(fn, "w") as fh: - fh.write(md_template.format(test_name)) - -for fn in existing_docs: - os.remove(fn) From 8805422edb65d1b31d6ae40fb38de2abdff6bc37 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Wed, 4 Aug 2021 17:34:26 +0200 Subject: [PATCH 02/12] Flesh out module lint tests descriptions, and create .md files --- .../_src/module_lint_tests/functions_nf.md | 5 ++++ docs/api/_src/module_lint_tests/index.md | 9 +++++++ docs/api/_src/module_lint_tests/main_nf.md | 6 +++++ docs/api/_src/module_lint_tests/meta_yml.md | 7 ++++++ .../_src/module_lint_tests/module_changes.md | 6 +++++ .../_src/module_lint_tests/module_todos.md | 5 ++++ docs/api/_src/pipeline_lint_tests/index.md | 2 +- docs/api/make_lint_md.py | 9 +++---- nf_core/lint/__init__.py | 8 +++---- nf_core/modules/lint/functions_nf.py | 9 ++++++- nf_core/modules/lint/main_nf.py | 16 ++++++++++--- nf_core/modules/lint/meta_yml.py | 14 ++++++++++- nf_core/modules/lint/module_changes.py | 7 ++++-- nf_core/modules/lint/module_tests.py | 9 +++++-- nf_core/modules/lint/module_todos.py | 24 +++++++++++++++++-- nf_core/modules/lint/module_version.py | 8 +++++-- 16 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 docs/api/_src/module_lint_tests/functions_nf.md create mode 100644 docs/api/_src/module_lint_tests/index.md create mode 100644 docs/api/_src/module_lint_tests/main_nf.md create mode 100644 docs/api/_src/module_lint_tests/meta_yml.md create mode 100644 docs/api/_src/module_lint_tests/module_changes.md create mode 100644 docs/api/_src/module_lint_tests/module_todos.md diff --git a/docs/api/_src/module_lint_tests/functions_nf.md b/docs/api/_src/module_lint_tests/functions_nf.md new file mode 100644 index 0000000000..c89d1d862c --- /dev/null +++ b/docs/api/_src/module_lint_tests/functions_nf.md @@ -0,0 +1,5 @@ +# functions_nf + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.functions_nf +``` diff --git a/docs/api/_src/module_lint_tests/index.md b/docs/api/_src/module_lint_tests/index.md new file mode 100644 index 0000000000..f889abf73c --- /dev/null +++ b/docs/api/_src/module_lint_tests/index.md @@ -0,0 +1,9 @@ +# Module lint tests + +```{toctree} +:caption: 'Tests:' +:glob: true +:maxdepth: 2 + +* +``` diff --git a/docs/api/_src/module_lint_tests/main_nf.md b/docs/api/_src/module_lint_tests/main_nf.md new file mode 100644 index 0000000000..452520d705 --- /dev/null +++ b/docs/api/_src/module_lint_tests/main_nf.md @@ -0,0 +1,6 @@ +# main_nf + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.main_nf +``` + diff --git a/docs/api/_src/module_lint_tests/meta_yml.md b/docs/api/_src/module_lint_tests/meta_yml.md new file mode 100644 index 0000000000..56e1bc8b7b --- /dev/null +++ b/docs/api/_src/module_lint_tests/meta_yml.md @@ -0,0 +1,7 @@ +# meta_yml + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.meta_yml +``` + + diff --git a/docs/api/_src/module_lint_tests/module_changes.md b/docs/api/_src/module_lint_tests/module_changes.md new file mode 100644 index 0000000000..afcd71b07b --- /dev/null +++ b/docs/api/_src/module_lint_tests/module_changes.md @@ -0,0 +1,6 @@ +# module_changes + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.module_changes +``` + diff --git a/docs/api/_src/module_lint_tests/module_todos.md b/docs/api/_src/module_lint_tests/module_todos.md new file mode 100644 index 0000000000..d592addd06 --- /dev/null +++ b/docs/api/_src/module_lint_tests/module_todos.md @@ -0,0 +1,5 @@ +# module_todos + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.module_todos +``` diff --git a/docs/api/_src/pipeline_lint_tests/index.md b/docs/api/_src/pipeline_lint_tests/index.md index d10f8421c5..0cf9bc1d21 100644 --- a/docs/api/_src/pipeline_lint_tests/index.md +++ b/docs/api/_src/pipeline_lint_tests/index.md @@ -1,4 +1,4 @@ -# Pipline lint tests +# Pipeline lint tests ```{toctree} :caption: 'Tests:' diff --git a/docs/api/make_lint_md.py b/docs/api/make_lint_md.py index 6b54dc8682..25e5539f67 100644 --- a/docs/api/make_lint_md.py +++ b/docs/api/make_lint_md.py @@ -20,6 +20,7 @@ def make_docs(docs_basedir, lint_tests, md_template): else: with open(fn, "w") as fh: fh.write(md_template.format(test_name)) + print(test_name) for fn in existing_docs: os.remove(fn) @@ -29,10 +30,10 @@ def make_docs(docs_basedir, lint_tests, md_template): pipeline_docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "pipeline_lint_tests") make_docs( pipeline_docs_basedir, - nf_core.lint.PipelineLint._get_all_lint_tests(), + nf_core.lint.PipelineLint._get_all_lint_tests(True), """# {0} - ```{eval-rst} + ```{{eval-rst}} .. automethod:: nf_core.lint.PipelineLint.{0} ``` @@ -40,13 +41,13 @@ def make_docs(docs_basedir, lint_tests, md_template): ) # Create the modules lint docs -modules_docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "modules_lint_tests") +modules_docs_basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_src", "module_lint_tests") make_docs( modules_docs_basedir, nf_core.modules.lint.ModuleLint._get_all_lint_tests(), """# {0} - ```{eval-rst} + ```{{eval-rst}} .. automethod:: nf_core.modules.lint.ModuleLint.{0} ``` diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index b61765b162..1f6d8e9253 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -20,8 +20,8 @@ import nf_core.utils import nf_core.lint_utils +import nf_core.modules.lint from nf_core.lint_utils import console -from nf_core.modules.lint import ModuleLint log = logging.getLogger(__name__) @@ -44,7 +44,7 @@ def run_linting( # Verify that the requested tests exist if key: - all_tests = set(PipelineLint._get_all_lint_tests(release_mode)).union(set(ModuleLint._get_all_lint_tests())) + all_tests = set(PipelineLint._get_all_lint_tests(release_mode)).union(set(nf_core.modules.lint.ModuleLint._get_all_lint_tests())) bad_keys = [k for k in key if k not in all_tests] if len(bad_keys) > 0: raise AssertionError( @@ -66,7 +66,7 @@ def run_linting( lint_obj._list_files() # Create the modules lint object - module_lint_obj = ModuleLint(pipeline_dir) + module_lint_obj = nf_core.modules.lint.ModuleLint(pipeline_dir) # Verify that the pipeline is correctly configured try: @@ -77,7 +77,7 @@ def run_linting( # Run only the tests we want if key: # Select only the module lint tests - module_lint_tests = list(set(key).intersection(set(ModuleLint._get_all_lint_tests()))) + module_lint_tests = list(set(key).intersection(set(nf_core.modules.lint.ModuleLint._get_all_lint_tests()))) else: # If no key is supplied, run the default modules tests module_lint_tests = ("module_changes", "module_version") diff --git a/nf_core/modules/lint/functions_nf.py b/nf_core/modules/lint/functions_nf.py index 600a1ae7fd..97be84560c 100644 --- a/nf_core/modules/lint/functions_nf.py +++ b/nf_core/modules/lint/functions_nf.py @@ -9,7 +9,14 @@ def functions_nf(module_lint_object, module): """ Lint a functions.nf file - Verifies that the file exists and contains all necessary functions + + Verifies that the file exists and contains the following functions:: + + getSoftwareName + initOptions + getPathFromList + saveFiles + """ local_copy = None template_copy = None diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py index 018dc99af2..9fc6f63f7f 100644 --- a/nf_core/modules/lint/main_nf.py +++ b/nf_core/modules/lint/main_nf.py @@ -10,10 +10,20 @@ def main_nf(module_lint_object, module): """ Lint a single main.nf module file + Can also be used to lint local module files, - in which case failures should be interpreted - as warnings + in which case failures will be reported as + warnings + + The test checks that software versions and + containers are correct. It warns if that the + module does not have a process label or if it + is not among the standard ones. + + In the modules script section it checks that + ``def software`` and ``def prefix`` are defined. """ + inputs = [] outputs = [] @@ -116,7 +126,7 @@ def main_nf(module_lint_object, module): def check_script_section(self, lines): """ Lint the script section - Checks whether 'def sotware' and 'def prefix' are defined + Checks whether 'def software' and 'def prefix' are defined """ script = "".join(lines) diff --git a/nf_core/modules/lint/meta_yml.py b/nf_core/modules/lint/meta_yml.py index be265a16ec..60e4832823 100644 --- a/nf_core/modules/lint/meta_yml.py +++ b/nf_core/modules/lint/meta_yml.py @@ -7,7 +7,19 @@ def meta_yml(module_lint_object, module): - """Lint a meta yml file""" + """ + Lint a meta.yml file + + The lint test checks that the module has + a ``meta.yml`` file and that it contains + the required keys: 'name', input' and + 'output'. + + In addition it checks that the module name + and module input is consistent between the + ``meta.yml`` and the ``main.nf``. + + """ required_keys = ["name", "input", "output"] required_keys_lists = ["input", "output"] try: diff --git a/nf_core/modules/lint/module_changes.py b/nf_core/modules/lint/module_changes.py index 57f3b9a03f..34354f1795 100644 --- a/nf_core/modules/lint/module_changes.py +++ b/nf_core/modules/lint/module_changes.py @@ -11,11 +11,14 @@ def module_changes(module_lint_object, module): """ Checks whether installed nf-core modules have changed compared to the original repository - Downloads the 'main.nf', 'functions.nf' and 'meta.yml' files for every module + + Downloads the ``main.nf``, ``functions.nf`` and ``meta.yml`` files for every module and compares them to the local copies - If the module has a 'git_sha', the file content is checked against this sha + If the module has a commit SHA entry in the ``modules.json``, the file content is + checked against this SHA """ + files_to_check = ["main.nf", "functions.nf", "meta.yml"] # Loop over nf-core modules diff --git a/nf_core/modules/lint/module_tests.py b/nf_core/modules/lint/module_tests.py index fad25d20ac..78cc18e063 100644 --- a/nf_core/modules/lint/module_tests.py +++ b/nf_core/modules/lint/module_tests.py @@ -3,7 +3,6 @@ """ import os import logging -import sys import yaml log = logging.getLogger(__name__) @@ -11,7 +10,13 @@ def module_tests(module_lint_object, module): """ - Lint module tests + Lint the tests of a module in nf-core/modules + + It verifies that the test directory exists + and contains a ``main.nf`` and a ``test.yml``, + and that the module is present in the ``pytest_modules.yml`` + file. + """ if os.path.exists(module.test_dir): diff --git a/nf_core/modules/lint/module_todos.py b/nf_core/modules/lint/module_todos.py index 57c73ebbcd..bbd1c4d6f7 100644 --- a/nf_core/modules/lint/module_todos.py +++ b/nf_core/modules/lint/module_todos.py @@ -8,8 +8,28 @@ def module_todos(module_lint_object, module): """ Look for TODO statements in the module files - Slight modification of the "nf_core.lint.pipeline_todos" function to make it work - for a single module + + The nf-core module template contains a number of comment lines to help developers + of new modules know where they need to edit files and add content. + They typically have the following format: + + .. code-block:: groovy + + // TODO nf-core: Make some kind of change to the workflow here + + ..or in markdown: + + .. code-block:: html + + + + This lint test runs through all files in the module and searches for these lines. + If any are found they will throw a warning. + + .. tip:: Note that many GUI code editors have plugins to list all instances of *TODO* + in a given project directory. This is a very quick and convenient way to get + started on your pipeline! + """ module.wf_path = module.module_dir results = pipeline_todos(module) diff --git a/nf_core/modules/lint/module_version.py b/nf_core/modules/lint/module_version.py index cc3e01c8be..03ea4f248c 100644 --- a/nf_core/modules/lint/module_version.py +++ b/nf_core/modules/lint/module_version.py @@ -18,9 +18,13 @@ def module_version(module_lint_object, module): """ - Verify that the module has a version (git_sha) specified in the - modules.json file and checks whether a new version is available + Verifies that the module has a version specified in the modules.json + + It checks whether the module has an entry in the ``modules.json`` file + containing a commit SHA. If that is true, it verifies that there are no + newer version of the module available. """ + modules_json_path = os.path.join(module_lint_object.dir, "modules.json") # Verify that a git_sha exists in the `modules.json` file for this module From 3bb958423a63cbd5f29a86076b271037606a11f4 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 10:28:23 +0200 Subject: [PATCH 03/12] Small fixes --- nf_core/lint/modules_json.py | 2 +- nf_core/modules/lint/main_nf.py | 23 +++++++++++++---------- nf_core/modules/lint/meta_yml.py | 4 ++-- nf_core/modules/lint/module_changes.py | 8 ++++---- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/nf_core/lint/modules_json.py b/nf_core/lint/modules_json.py index 07abf94987..4c5923d508 100644 --- a/nf_core/lint/modules_json.py +++ b/nf_core/lint/modules_json.py @@ -8,7 +8,7 @@ def modules_json(self): """Make sure all modules described in the ``modules.json`` file are actually installed Every module installed from ``nf-core/modules`` must have an entry in the ``modules.json`` file - with an associated version git_sha hash. + with an associated version commit hash. * Failure: If module entries are found in ``modules.json`` for modules that are not installed """ diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py index 9fc6f63f7f..9b6d266728 100644 --- a/nf_core/modules/lint/main_nf.py +++ b/nf_core/modules/lint/main_nf.py @@ -13,15 +13,18 @@ def main_nf(module_lint_object, module): Can also be used to lint local module files, in which case failures will be reported as - warnings - - The test checks that software versions and - containers are correct. It warns if that the - module does not have a process label or if it - is not among the standard ones. - - In the modules script section it checks that - ``def software`` and ``def prefix`` are defined. + warnings. + + The test checks for the following: + + * Software versions and containers are valid + * The module has a process label and it is among + the standard ones. + * If a ``meta`` map is defined as one of the modules + inputs it should be defined as one of the outputs, + and be correctly configured in the ``saveAs`` function. + * The module script section should contain definitions + of ``software`` and ``prefix`` """ inputs = [] @@ -162,7 +165,7 @@ def check_process_section(self, lines): if all([x.upper() for x in self.process_name]): self.passed.append(("process_capitals", "Process name is in capital letters", self.main_nf)) else: - self.failed.append(("process_capitals", "Process name is not in captial letters", self.main_nf)) + self.failed.append(("process_capitals", "Process name is not in capital letters", self.main_nf)) # Check that process labels are correct correct_process_labels = ["process_low", "process_medium", "process_high", "process_long"] diff --git a/nf_core/modules/lint/meta_yml.py b/nf_core/modules/lint/meta_yml.py index 60e4832823..561f230c91 100644 --- a/nf_core/modules/lint/meta_yml.py +++ b/nf_core/modules/lint/meta_yml.py @@ -12,8 +12,8 @@ def meta_yml(module_lint_object, module): The lint test checks that the module has a ``meta.yml`` file and that it contains - the required keys: 'name', input' and - 'output'. + the required keys: ``name``, input`` and + ``output``. In addition it checks that the module name and module input is consistent between the diff --git a/nf_core/modules/lint/module_changes.py b/nf_core/modules/lint/module_changes.py index 34354f1795..b75b2e0067 100644 --- a/nf_core/modules/lint/module_changes.py +++ b/nf_core/modules/lint/module_changes.py @@ -10,13 +10,13 @@ def module_changes(module_lint_object, module): """ Checks whether installed nf-core modules have changed compared to the - original repository + original repository. - Downloads the ``main.nf``, ``functions.nf`` and ``meta.yml`` files for every module - and compares them to the local copies + Downloads the ``main.nf``, ``functions.nf`` and ``meta.yml`` files from the remote + for every module and compares them to the local copies. If the module has a commit SHA entry in the ``modules.json``, the file content is - checked against this SHA + compared against the files in the remote at this SHA. """ files_to_check = ["main.nf", "functions.nf", "meta.yml"] From fee0040a9a25a07de6f431e43185d40e87010627 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 10:33:37 +0200 Subject: [PATCH 04/12] Minor changes --- nf_core/modules/lint/functions_nf.py | 2 +- nf_core/modules/lint/main_nf.py | 2 +- nf_core/modules/lint/meta_yml.py | 2 +- nf_core/modules/lint/module_tests.py | 2 +- nf_core/modules/lint/module_version.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nf_core/modules/lint/functions_nf.py b/nf_core/modules/lint/functions_nf.py index 97be84560c..f927e55ffc 100644 --- a/nf_core/modules/lint/functions_nf.py +++ b/nf_core/modules/lint/functions_nf.py @@ -8,7 +8,7 @@ def functions_nf(module_lint_object, module): """ - Lint a functions.nf file + Lint a ``functions.nf`` file Verifies that the file exists and contains the following functions:: diff --git a/nf_core/modules/lint/main_nf.py b/nf_core/modules/lint/main_nf.py index 9b6d266728..555fcedc5a 100644 --- a/nf_core/modules/lint/main_nf.py +++ b/nf_core/modules/lint/main_nf.py @@ -9,7 +9,7 @@ def main_nf(module_lint_object, module): """ - Lint a single main.nf module file + Lint a ``main.nf`` module file Can also be used to lint local module files, in which case failures will be reported as diff --git a/nf_core/modules/lint/meta_yml.py b/nf_core/modules/lint/meta_yml.py index 561f230c91..3c59c774d4 100644 --- a/nf_core/modules/lint/meta_yml.py +++ b/nf_core/modules/lint/meta_yml.py @@ -8,7 +8,7 @@ def meta_yml(module_lint_object, module): """ - Lint a meta.yml file + Lint a ``meta.yml`` file The lint test checks that the module has a ``meta.yml`` file and that it contains diff --git a/nf_core/modules/lint/module_tests.py b/nf_core/modules/lint/module_tests.py index 78cc18e063..f76d45d69f 100644 --- a/nf_core/modules/lint/module_tests.py +++ b/nf_core/modules/lint/module_tests.py @@ -10,7 +10,7 @@ def module_tests(module_lint_object, module): """ - Lint the tests of a module in nf-core/modules + Lint the tests of a module in ``nf-core/modules`` It verifies that the test directory exists and contains a ``main.nf`` and a ``test.yml``, diff --git a/nf_core/modules/lint/module_version.py b/nf_core/modules/lint/module_version.py index 03ea4f248c..29d7327490 100644 --- a/nf_core/modules/lint/module_version.py +++ b/nf_core/modules/lint/module_version.py @@ -18,7 +18,7 @@ def module_version(module_lint_object, module): """ - Verifies that the module has a version specified in the modules.json + Verifies that the module has a version specified in the ``modules.json`` file It checks whether the module has an entry in the ``modules.json`` file containing a commit SHA. If that is true, it verifies that there are no From 2aad12159eb34132572aac0baba3e54e0ec88f50 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 10:50:06 +0200 Subject: [PATCH 05/12] run markdownlint --- docs/api/_src/module_lint_tests/main_nf.md | 1 - docs/api/_src/module_lint_tests/meta_yml.md | 2 -- docs/api/_src/module_lint_tests/module_changes.md | 1 - 3 files changed, 4 deletions(-) diff --git a/docs/api/_src/module_lint_tests/main_nf.md b/docs/api/_src/module_lint_tests/main_nf.md index 452520d705..5a96785733 100644 --- a/docs/api/_src/module_lint_tests/main_nf.md +++ b/docs/api/_src/module_lint_tests/main_nf.md @@ -3,4 +3,3 @@ ```{eval-rst} .. automethod:: nf_core.modules.lint.ModuleLint.main_nf ``` - diff --git a/docs/api/_src/module_lint_tests/meta_yml.md b/docs/api/_src/module_lint_tests/meta_yml.md index 56e1bc8b7b..33920a4b9b 100644 --- a/docs/api/_src/module_lint_tests/meta_yml.md +++ b/docs/api/_src/module_lint_tests/meta_yml.md @@ -3,5 +3,3 @@ ```{eval-rst} .. automethod:: nf_core.modules.lint.ModuleLint.meta_yml ``` - - diff --git a/docs/api/_src/module_lint_tests/module_changes.md b/docs/api/_src/module_lint_tests/module_changes.md index afcd71b07b..ce2d428ca9 100644 --- a/docs/api/_src/module_lint_tests/module_changes.md +++ b/docs/api/_src/module_lint_tests/module_changes.md @@ -3,4 +3,3 @@ ```{eval-rst} .. automethod:: nf_core.modules.lint.ModuleLint.module_changes ``` - From 1ea015e68fa1e4e92526373fe582998a48106817 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 10:57:46 +0200 Subject: [PATCH 06/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f37986284..cc296788a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Changed `questionary` `ask()` to `unsafe_ask()` to not catch `KeyboardInterupts` ([#1237](https://github.com/nf-core/tools/issues/1237)) * Convert documentation to MyST. +* Add documentation for the `nf-core modules lint` tests. ### Modules From d3f1b85035d612d15e719f08eec1f8d7d5bae874 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 11:05:21 +0200 Subject: [PATCH 07/12] Fix issues in md templates --- docs/api/make_lint_md.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/api/make_lint_md.py b/docs/api/make_lint_md.py index 25e5539f67..a6ec98a944 100644 --- a/docs/api/make_lint_md.py +++ b/docs/api/make_lint_md.py @@ -33,11 +33,10 @@ def make_docs(docs_basedir, lint_tests, md_template): nf_core.lint.PipelineLint._get_all_lint_tests(True), """# {0} - ```{{eval-rst}} - .. automethod:: nf_core.lint.PipelineLint.{0} - ``` - - """, +```{{eval-rst}} +.. automethod:: nf_core.lint.PipelineLint.{0} +``` +""", ) # Create the modules lint docs @@ -47,9 +46,8 @@ def make_docs(docs_basedir, lint_tests, md_template): nf_core.modules.lint.ModuleLint._get_all_lint_tests(), """# {0} - ```{{eval-rst}} - .. automethod:: nf_core.modules.lint.ModuleLint.{0} - ``` - - """, +```{{eval-rst}} +.. automethod:: nf_core.modules.lint.ModuleLint.{0} +``` +""", ) From 1b151d22ecb4caf5bf58c6aa690ff04ee506261d Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Thu, 5 Aug 2021 11:08:28 +0200 Subject: [PATCH 08/12] black --- nf_core/lint/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index 1f6d8e9253..4838726928 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -44,7 +44,9 @@ def run_linting( # Verify that the requested tests exist if key: - all_tests = set(PipelineLint._get_all_lint_tests(release_mode)).union(set(nf_core.modules.lint.ModuleLint._get_all_lint_tests())) + all_tests = set(PipelineLint._get_all_lint_tests(release_mode)).union( + set(nf_core.modules.lint.ModuleLint._get_all_lint_tests()) + ) bad_keys = [k for k in key if k not in all_tests] if len(bad_keys) > 0: raise AssertionError( From 0926f0395d68f16e13b5677ef4ae53676f2161e3 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 16 Mar 2022 15:57:36 +0100 Subject: [PATCH 09/12] Fix github wf variable names in deploy workflow --- .github/workflows/tools-api-docs-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tools-api-docs-dev.yml b/.github/workflows/tools-api-docs-dev.yml index 8a45922c7c..34feec23f1 100644 --- a/.github/workflows/tools-api-docs-dev.yml +++ b/.github/workflows/tools-api-docs-dev.yml @@ -27,7 +27,7 @@ jobs: - name: Sync dev docs # Only sync with the website if it was a push from nf-core/tools dev branch - if: github.repository == 'nf-core/tools' && github.event.type == 'push' && github.event.base_ref == 'refs/heads/dev' + if: github.repository == 'nf-core/tools' && github.event_name == 'push' && github.event.ref == 'refs/heads/dev' uses: SamKirkland/FTP-Deploy-Action@4.0.0 with: server: ${{ secrets.ftp_server }} From 21d1b4fe881df8c20ea77a95a2b5d725976b9152 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 16 Mar 2022 16:08:38 +0100 Subject: [PATCH 10/12] Remove sphinx scaffold page for old functions_nf.md --- docs/api/_src/module_lint_tests/functions_nf.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 docs/api/_src/module_lint_tests/functions_nf.md diff --git a/docs/api/_src/module_lint_tests/functions_nf.md b/docs/api/_src/module_lint_tests/functions_nf.md deleted file mode 100644 index c89d1d862c..0000000000 --- a/docs/api/_src/module_lint_tests/functions_nf.md +++ /dev/null @@ -1,5 +0,0 @@ -# functions_nf - -```{eval-rst} -.. automethod:: nf_core.modules.lint.ModuleLint.functions_nf -``` From c3224a6429b50254bb27024a9347c369726b1a5c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 16 Mar 2022 16:11:37 +0100 Subject: [PATCH 11/12] Ran make_lint_md.py --- docs/api/_src/module_lint_tests/module_changes.md | 5 ----- docs/api/_src/module_lint_tests/module_deprecations.md | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 docs/api/_src/module_lint_tests/module_changes.md create mode 100644 docs/api/_src/module_lint_tests/module_deprecations.md diff --git a/docs/api/_src/module_lint_tests/module_changes.md b/docs/api/_src/module_lint_tests/module_changes.md deleted file mode 100644 index ce2d428ca9..0000000000 --- a/docs/api/_src/module_lint_tests/module_changes.md +++ /dev/null @@ -1,5 +0,0 @@ -# module_changes - -```{eval-rst} -.. automethod:: nf_core.modules.lint.ModuleLint.module_changes -``` diff --git a/docs/api/_src/module_lint_tests/module_deprecations.md b/docs/api/_src/module_lint_tests/module_deprecations.md new file mode 100644 index 0000000000..f00b4dc54d --- /dev/null +++ b/docs/api/_src/module_lint_tests/module_deprecations.md @@ -0,0 +1,5 @@ +# module_deprecations + +```{eval-rst} +.. automethod:: nf_core.modules.lint.ModuleLint.module_deprecations +``` From 01597b7ca0cab3fb92ff124217794a60acf25ca7 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 16 Mar 2022 16:24:27 +0100 Subject: [PATCH 12/12] Fix broken links --- docs/api/_src/api/lint.md | 2 +- docs/api/_src/index.md | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/api/_src/api/lint.md b/docs/api/_src/api/lint.md index a0e3a6d5c9..cb75b0ecb5 100644 --- a/docs/api/_src/api/lint.md +++ b/docs/api/_src/api/lint.md @@ -1,7 +1,7 @@ # nf_core.lint :::{seealso} -See the [Lint Tests](../lint_tests/index.html) docs for information about specific linting functions. +See the [Lint Tests](../pipeline_lint_tests/index.md) docs for information about specific linting functions. ::: ```{eval-rst} diff --git a/docs/api/_src/index.md b/docs/api/_src/index.md index a6fb767122..de39e7244b 100644 --- a/docs/api/_src/index.md +++ b/docs/api/_src/index.md @@ -13,12 +13,10 @@ api/index.rst This documentation is for the `nf-core/tools` package. -Primarily, it describes the different [code lint tests](lint_tests/index.html) -run by `nf-core lint` (typically visited by a developer when their pipeline fails a given -test), and also reference for the `nf_core` [Python package API](api/index.html). - -## Indices and tables +## Contents +- [Pipeline code lint tests](pipeline_lint_tests/index.md) (run by `nf-core lint`) +- [Module code lint tests](module_lint_tests/index.md) (run by `nf-core modules lint`) +- [nf-core/tools Python package API reference](api/index.md) - {ref}`genindex` - {ref}`modindex` -- {ref}`search`