nf_core.pipelines.utils

nf_core.pipelines.lint_utils.check_git_repo() → bool

Check if the current directory is a git repository.

nf_core.pipelines.lint_utils.dump_json_with_prettier(file_name: Path | str, file_content: Mapping[str, Any]) → None

Dump a JSON file and run prettier on it.

  • Parameters:
    • file_name (Path | str) – A file identifier as a string or pathlib.Path.
    • file_content (Mapping *[*str , Any ]) – Content to dump into the JSON file

nf_core.pipelines.lint_utils.dump_yaml_with_prettier(file_name: Path | str, file_content: dict) → None

Dump a YAML file and run prettier on it.

  • Parameters:
    • file_name (Path | str) – A file identifier as a string or pathlib.Path.
    • file_content (dict) – Content to dump into the YAML file

nf_core.pipelines.lint_utils.ignore_file(lint_name: str, file_path: Path, dir_path: Path) → list[list[str]]

Ignore a file and add the result to the ignored list. Return the passed, failed, ignored and ignore_configs lists.

nf_core.pipelines.lint_utils.print_fixes(lint_obj, plain_text=False)

Prints available and applied fixes

nf_core.pipelines.lint_utils.print_joint_summary(lint_obj, module_lint_obj, subworkflow_lint_obj, plain_text=False)

Print a joint summary of the general pipe lint tests and the module and subworkflow lint tests

nf_core.pipelines.lint_utils.print_results_plain_text(results_list, directory=None, component_type=None)

Print lint results in plain text format.

  • Parameters:
    • results_list – List of tuples (results, symbol, label, color, show_condition)
    • directory – Base directory for relative paths (for component linting)
    • component_type – “modules” or “subworkflows” (for component linting)

nf_core.pipelines.lint_utils.print_summary(rows, plain_text=False, summary_colour=None)

Print a summary table in plain text or rich format.

  • Parameters:
    • rows – List of tuples (count, icon, label, color, always_show)
    • plain_text – If True, print in plain text format
    • summary_colour – Color for the rich table border (default: auto based on failures)

nf_core.pipelines.lint_utils.run_prettier_on_file(*files: Path) → None

Run the pre-commit hook prettier on one or more files.

Skipped (with a debug message) outside a git repository. Syntax errors in a file are logged as critical, any other prettier/prek failure as a warning.

  • Parameters: *files (Path) – The files to format.