Esempio n. 1
0
    def lint(self):
        """Perform linting on this module"""
        # Iterate over modules and run all checks on them

        # Lint the main.nf file
        self.lint_main_nf()

        # Lint the meta.yml file
        self.lint_meta_yml()

        # Lint the functions.nf file
        self.lint_functions_nf()

        # Lint the tests
        if self.repo_type == "modules":
            self.lint_module_tests()

        # Check for TODOs
        self.wf_path = self.module_dir
        module_todos = pipeline_todos(self)
        for i, warning in enumerate(module_todos["warned"]):
            self.warned.append(
                ("module_todo", warning, module_todos["file_paths"][i]))

        return self.passed, self.warned, self.failed
Esempio n. 2
0
def module_todos(module_lint_object, module):
    """
    Look for TODO statements in the module files

    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

        <!-- TODO nf-core: Add some detail to the docs here -->

    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!

    """

    # Main module directory
    mod_results = pipeline_todos(None, root_dir=module.module_dir)
    for i, warning in enumerate(mod_results["warned"]):
        module.warned.append(
            ("module_todo", warning, mod_results["file_paths"][i]))
    for i, passed in enumerate(mod_results["passed"]):
        module.passed.append(("module_todo", passed, module.module_dir))

    # Module tests directory
    test_results = pipeline_todos(None, root_dir=module.test_dir)
    for i, warning in enumerate(test_results["warned"]):
        module.warned.append(
            ("module_todo", warning, test_results["file_paths"][i]))
    for i, passed in enumerate(test_results["passed"]):
        module.passed.append(("module_todo", passed, module.test_dir))
Esempio n. 3
0
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
    """
    module.wf_path = module.module_dir
    results = pipeline_todos(module)
    for i, warning in enumerate(results["warned"]):
        module.warned.append(
            ("module_todo", warning, results["file_paths"][i]))