diff --git a/package-lock.json b/package-lock.json index 9f60fc6ba9..7fb20a8c9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16401,7 +16401,6 @@ "integrity": "sha512-kgW13M54DUB7IsIRM5LvJkNlpH+WhMpooUcaWGFARkF1Tc82v9mIWkCbCYf+MBvpIUBSeSOTilpZjEPr2VYE6Q==", "license": "MIT", "optional": true, - "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.1.5", @@ -16471,7 +16470,6 @@ ], "license": "MIT", "optional": true, - "peer": true, "dependencies": { "sass": "1.99.0" } @@ -16488,7 +16486,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16505,7 +16502,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16522,7 +16518,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16539,7 +16534,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16556,7 +16550,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16573,7 +16566,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16590,7 +16582,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16607,7 +16598,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16624,7 +16614,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16641,7 +16630,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16658,7 +16646,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16675,7 +16662,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16692,7 +16678,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16709,7 +16694,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16726,7 +16710,6 @@ "!linux", "!win32" ], - "peer": true, "dependencies": { "sass": "1.99.0" } @@ -16743,7 +16726,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=14.0.0" } @@ -16760,7 +16742,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=14.0.0" } diff --git a/sites/docs/src/content/api_reference/dev/api/nf_core_yml.md b/sites/docs/src/content/api_reference/dev/api/nf_core_yml.md new file mode 100644 index 0000000000..434c4f1766 --- /dev/null +++ b/sites/docs/src/content/api_reference/dev/api/nf_core_yml.md @@ -0,0 +1,333 @@ +# .nf-core.yml configuration + +The `.nf-core.yml` file at the root of any nf-core repository controls how nf-core +tools behaves for that repository. It is read by `load_tools_config()` and validated +against the `NFCoreYamlConfig` Pydantic model. + +## Minimal examples + +Pipeline repository: + +```yaml +repository_type: pipeline +nf_core_version: "4.0.2" +``` + +Modules repository: + +```yaml +repository_type: modules +nf_core_version: "4.0.2" +container-registry: + - community.wave.seqera.io/library/ +``` + +## Schema + +### `Top-level{:python}``.nf-core.yml``schema ({:python}``NFCoreYamlConfig``){:python}` + +### _`pydantic model{:python}`_`nf_core.utils.NFCoreYamlConfig{:python}` + +Bases: `BaseModel` + +.nf-core.yml configuration file schema + +- **Fields:** + - [`bump_version (dict[str, bool] | None)`](utils#nf_core.utils.NFCoreYamlConfig.bump_version) + - [`container_registry (list[str] | None)`](utils#nf_core.utils.NFCoreYamlConfig.container_registry) + - [`lint (nf_core.utils.NFCoreYamlLintConfig | None)`](utils#nf_core.utils.NFCoreYamlConfig.lint) + - [`nf_core_version (str | None)`](utils#nf_core.utils.NFCoreYamlConfig.nf_core_version) + - [`org_path (str | None)`](utils#nf_core.utils.NFCoreYamlConfig.org_path) + - [`repository_type (Literal['pipeline', 'modules'] | None)`](utils#nf_core.utils.NFCoreYamlConfig.repository_type) + - [`template (nf_core.utils.NFCoreTemplateConfig | None)`](utils#nf_core.utils.NFCoreYamlConfig.template) + - [`update (dict[str, str | bool | dict[str, str | dict[str, str | bool]]] | None)`](utils#nf_core.utils.NFCoreYamlConfig.update) + +#### _`field{:python}`_`bump_version{:python}`_: dict\[str, bool] | None_`{:python}`_= None_ + +Disable bumping of the version for a module/subworkflow (when repository_type is modules). See for more information. + +#### _`field{:python}`_`container_registry{:python}`_: list\[str] | None_`{:python}`_= None_`{:python}`_(alias 'container-registry')_ + +Additional container registry prefixes allowed when linting container directives. + +#### _`field{:python}`_`lint{:python}`_: [NFCoreYamlLintConfig](utils#nf_core.utils.NFCoreYamlLintConfig) | None_`{:python}`_= None_ + +Pipeline linting configuration, see for examples and documentation + +#### _`field{:python}`_`nf_core_version{:python}`_: str | None_`{:python}`_= None_ + +Version of nf-core/tools used to create/update the pipeline + +#### _`field{:python}`_`org_path{:python}`_: str | None_`{:python}`_= None_ + +Path to the organisation’s modules repository (used for modules repo_type only) + +#### _`field{:python}`_`repository_type{:python}`_: Literal\['pipeline', 'modules'] | None_`{:python}`_= None_ + +Type of repository + +#### _`field{:python}`_`template{:python}`_: [NFCoreTemplateConfig](utils#nf_core.utils.NFCoreTemplateConfig) | None_`{:python}`_= None_ + +Pipeline template configuration + +#### _`field{:python}`_`update{:python}`_: dict\[str, str | bool | dict\[str, str | dict\[str, str | bool]]] | None_`{:python}`_= None_ + +Disable updating specific modules/subworkflows (when repository_type is pipeline). See for more information. + +### `lint``block ({:python}``NFCoreYamlLintConfig``){:python}` + +### _`pydantic model{:python}`_`nf_core.utils.NFCoreYamlLintConfig{:python}` + +Bases: `BaseModel` + +schema for linting config in .nf-core.yml should cover: + +```yaml +files_unchanged: + - .github/workflows/branch.yml +modules_config: False +modules_config: + - fastqc +# merge_markers: False +merge_markers: + - docs/my_pdf.pdf +nextflow_config: False +nextflow_config: + - manifest.name + - config_defaults: + - params.annotation_db + - params.multiqc_comment_headers + - params.custom_table_headers +# multiqc_config: False +multiqc_config: + - report_section_order + - report_comment +files_exist: + - CITATIONS.md +template_strings: False +template_strings: + - docs/my_pdf.pdf +nfcore_components: False +# nf_test_content: False +nf_test_content: + - tests/.nf.test + - tests/nextflow.config + - nf-test.config +``` + +- **Fields:** + - [`actions_awsfulltest (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.actions_awsfulltest) + - [`actions_awstest (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.actions_awstest) + - [`actions_nf_test (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.actions_nf_test) + - [`actions_schema_validation (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.actions_schema_validation) + - [`base_config (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.base_config) + - [`container_configs (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.container_configs) + - [`files_exist (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.files_exist) + - [`files_unchanged (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.files_unchanged) + - [`included_configs (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.included_configs) + - [`local_component_structure (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.local_component_structure) + - [`merge_markers (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.merge_markers) + - [`modules_config (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.modules_config) + - [`modules_json (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.modules_json) + - [`modules_structure (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.modules_structure) + - [`multiqc_config (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.multiqc_config) + - [`nextflow_config (bool | list[str | dict[str, list[str]]] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.nextflow_config) + - [`nf_test_content (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.nf_test_content) + - [`nfcore_components (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.nfcore_components) + - [`nfcore_yml (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.nfcore_yml) + - [`pipeline_if_empty_null (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.pipeline_if_empty_null) + - [`pipeline_name_conventions (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.pipeline_name_conventions) + - [`pipeline_todos (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.pipeline_todos) + - [`plugin_includes (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.plugin_includes) + - [`readme (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.readme) + - [`rocrate_readme_sync (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.rocrate_readme_sync) + - [`schema_description (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.schema_description) + - [`schema_lint (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.schema_lint) + - [`schema_params (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.schema_params) + - [`system_exit (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.system_exit) + - [`template_strings (bool | list[str] | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.template_strings) + - [`version_consistency (bool | None)`](utils#nf_core.utils.NFCoreYamlLintConfig.version_consistency) + +#### _`field{:python}`_`actions_awsfulltest{:python}`_: bool | None_`{:python}`_= None_ + +Lint all required files to run full tests on AWS + +#### _`field{:python}`_`actions_awstest{:python}`_: bool | None_`{:python}`_= None_ + +Lint all required files to run tests on AWS + +#### _`field{:python}`_`actions_nf_test{:python}`_: bool | None_`{:python}`_= None_ + +Lint all required files to use GitHub Actions CI + +#### _`field{:python}`_`actions_schema_validation{:python}`_: bool | None_`{:python}`_= None_ + +Lint GitHub Action workflow files with schema + +#### _`field{:python}`_`base_config{:python}`_: bool | None_`{:python}`_= None_ + +Lint base.config file + +#### _`field{:python}`_`container_configs{:python}`_: bool | None_`{:python}`_= None_ + +Lint that container configuration files in conf/ are up to date + +#### _`field{:python}`_`files_exist{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of files that can not exist + +#### _`field{:python}`_`files_unchanged{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of files that should not be changed + +#### _`field{:python}`_`included_configs{:python}`_: bool | None_`{:python}`_= None_ + +Lint for included configs + +#### _`field{:python}`_`local_component_structure{:python}`_: bool | None_`{:python}`_= None_ + +Lint local components use correct structure mirroring remote + +#### _`field{:python}`_`merge_markers{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of files that should not contain merge markers + +#### _`field{:python}`_`modules_config{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of modules that should not be changed + +#### _`field{:python}`_`modules_json{:python}`_: bool | None_`{:python}`_= None_ + +Lint modules.json file + +#### _`field{:python}`_`modules_structure{:python}`_: bool | None_`{:python}`_= None_ + +Lint modules structure + +#### _`field{:python}`_`multiqc_config{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of MultiQC config options that be changed + +#### _`field{:python}`_`nextflow_config{:python}`_: bool | list\[str | dict\[str, list\[str]]] | None_`{:python}`_= None_ + +List of Nextflow config files that should not be changed + +#### _`field{:python}`_`nf_test_content{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of nf-test content that should not be changed + +#### _`field{:python}`_`nfcore_components{:python}`_: bool | None_`{:python}`_= None_ + +Lint all required files to use nf-core modules and subworkflows + +#### _`field{:python}`_`nfcore_yml{:python}`_: bool | None_`{:python}`_= None_ + +Lint nf-core.yml + +#### _`field{:python}`_`pipeline_if_empty_null{:python}`_: bool | None_`{:python}`_= None_ + +Lint for ifEmpty(null) statements + +#### _`field{:python}`_`pipeline_name_conventions{:python}`_: bool | None_`{:python}`_= None_ + +Lint for pipeline name conventions + +#### _`field{:python}`_`pipeline_todos{:python}`_: bool | None_`{:python}`_= None_ + +Lint for TODOs statements + +#### _`field{:python}`_`plugin_includes{:python}`_: bool | None_`{:python}`_= None_ + +Lint for nextflow plugin + +#### _`field{:python}`_`readme{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +Lint the README.md file + +#### _`field{:python}`_`rocrate_readme_sync{:python}`_: bool | None_`{:python}`_= None_ + +Lint for README.md and rocrate.json sync + +#### _`field{:python}`_`schema_description{:python}`_: bool | None_`{:python}`_= None_ + +Check that every parameter in the schema has a description. + +#### _`field{:python}`_`schema_lint{:python}`_: bool | None_`{:python}`_= None_ + +Lint nextflow_schema.json file + +#### _`field{:python}`_`schema_params{:python}`_: bool | None_`{:python}`_= None_ + +Lint schema for all params + +#### _`field{:python}`_`system_exit{:python}`_: bool | None_`{:python}`_= None_ + +Lint for System.exit calls in groovy/nextflow code + +#### _`field{:python}`_`template_strings{:python}`_: bool | list\[str] | None_`{:python}`_= None_ + +List of files that can contain template strings + +#### _`field{:python}`_`version_consistency{:python}`_: bool | None_`{:python}`_= None_ + +Lint for version consistency + +### `template``block ({:python}``NFCoreTemplateConfig``){:python}` + +### _`pydantic model{:python}`_`nf_core.utils.NFCoreTemplateConfig{:python}` + +Bases: `BaseModel` + +Template configuration schema + +- **Fields:** + - [`author (str | None)`](utils#nf_core.utils.NFCoreTemplateConfig.author) + - [`description (str | None)`](utils#nf_core.utils.NFCoreTemplateConfig.description) + - [`force (bool | None)`](utils#nf_core.utils.NFCoreTemplateConfig.force) + - [`is_nfcore (bool | None)`](utils#nf_core.utils.NFCoreTemplateConfig.is_nfcore) + - [`name (str | None)`](utils#nf_core.utils.NFCoreTemplateConfig.name) + - [`org (str | None)`](utils#nf_core.utils.NFCoreTemplateConfig.org) + - [`outdir (str | pathlib.Path | None)`](utils#nf_core.utils.NFCoreTemplateConfig.outdir) + - [`skip_features (list | None)`](utils#nf_core.utils.NFCoreTemplateConfig.skip_features) + - [`version (str | None)`](utils#nf_core.utils.NFCoreTemplateConfig.version) +- **Validators:** + - [`outdir_to_str`](utils#nf_core.utils.NFCoreTemplateConfig.outdir_to_str) » [`outdir`](utils#nf_core.utils.NFCoreTemplateConfig.outdir) + +#### _`field{:python}`_`author{:python}`_: str | None_`{:python}`_= None_ + +Pipeline author + +#### _`field{:python}`_`description{:python}`_: str | None_`{:python}`_= None_ + +Pipeline description + +#### _`field{:python}`_`force{:python}`_: bool | None_`{:python}`_= True_ + +Force overwrite of existing files + +#### _`field{:python}`_`is_nfcore{:python}`_: bool | None_`{:python}`_= None_ + +Whether the pipeline is an nf-core pipeline. + +#### _`field{:python}`_`name{:python}`_: str | None_`{:python}`_= None_ + +Pipeline name + +#### _`field{:python}`_`org{:python}`_: str | None_`{:python}`_= None_ + +Organisation name + +#### _`field{:python}`_`outdir{:python}`_: str | Path | None_`{:python}`_= None_ + +Output directory + +- **Validated by:** + - [`outdir_to_str`](utils#nf_core.utils.NFCoreTemplateConfig.outdir_to_str) + +#### _`field{:python}`_`skip_features{:python}`_: list | None_`{:python}`_= None_ + +Skip features. See for a list of features. + +#### _`field{:python}`_`version{:python}`_: str | None_`{:python}`_= None_ + +Pipeline version diff --git a/sites/docs/src/content/api_reference/dev/api/pipelines/index.md b/sites/docs/src/content/api_reference/dev/api/pipelines/index.md index 207189bbcc..3cfe514e5b 100644 --- a/sites/docs/src/content/api_reference/dev/api/pipelines/index.md +++ b/sites/docs/src/content/api_reference/dev/api/pipelines/index.md @@ -5,8 +5,8 @@ - [nf_core.pipelines.download](download) - [nf_core.pipelines.launch](launch) - [nf_core.pipelines.lint](lint) +- [nf_core.pipelines.utils](lint_utils) - [nf_core.pipelines.list](list) - [nf_core.pipelines.params_file](params-file) - [nf_core.pipelines.schema](schema) - [nf_core.pipelines.sync](sync) -- [nf_core.pipelines.utils](utils) diff --git a/sites/docs/src/content/api_reference/dev/api/pipelines/lint.md b/sites/docs/src/content/api_reference/dev/api/pipelines/lint.md index 8010b15897..2324698dbc 100644 --- a/sites/docs/src/content/api_reference/dev/api/pipelines/lint.md +++ b/sites/docs/src/content/api_reference/dev/api/pipelines/lint.md @@ -11,18 +11,125 @@ Linting policy for nf-core pipeline projects. Tests Nextflow-based pipelines to check that they adhere to the nf-core community guidelines. -### `nf_core.pipelines.lint.run_linting(pipeline_dir, release_mode: bool = False, fix=(), key=(), show_passed: bool = False, fail_ignored: bool = False, fail_warned: bool = False, sort_by: str = 'test', md_fn=None, json_fn=None, hide_progress: bool = False, plain_text: bool = False) → tuple[PipelineLint, ComponentLint | None, ComponentLint | None]{:python}` +### `nf_core.pipelines.lint.run_linting(pipeline_dir, release_mode: bool = False, fix=(), key=(), show_passed: bool = False, fail_ignored: bool = False, fail_warned: bool = False, sort_by: str = 'test', md_fn=None, json_fn=None, hide_progress: bool = False, plain_text: bool = False) → tuple[{:python}`[`PipelineLint{:python}`](#nf_core.pipelines.lint.PipelineLint)`, ComponentLint | None, ComponentLint | None]{:python}` Runs all nf-core linting checks on a given Nextflow pipeline project in either release mode or normal mode (default). Returns an object -of type `PipelineLint` after finished. +of type [`PipelineLint`](#nf_core.pipelines.lint.PipelineLint) after finished. - **Parameters:** - **pipeline_dir** (_str_) – The path to the Nextflow pipeline root directory - **release_mode** (_bool_) – Set this to True, if the linting should be run in the release mode. - See `PipelineLint` for more information. + See [`PipelineLint`](#nf_core.pipelines.lint.PipelineLint) for more information. - **plain_text** (_bool_) – Print output in plain text without rich formatting - **Returns:** - An object of type `PipelineLint` that contains all the linting results. + An object of type [`PipelineLint`](#nf_core.pipelines.lint.PipelineLint) that contains all the linting results. An object of type `ComponentLint` that contains all the linting results for the modules. An object of type `ComponentLint` that contains all the linting results for the subworkflows. + +### _`class{:python}`_`nf_core.pipelines.lint.PipelineLint(wf_path, release_mode=False, fix=(), key=None, fail_ignored=False, fail_warned=False, hide_progress=False){:python}` + +Bases: [`Pipeline`](../utils#nf_core.utils.Pipeline) + +Object to hold linting information and results. + +Inherits [`nf_core.utils.Pipeline`](../utils#nf_core.utils.Pipeline) class. + +Use the [`PipelineLint._lint_pipeline()`](#nf_core.pipelines.lint.PipelineLint._lint_pipeline) function to run lint tests. + +- **Parameters:** + **path** (_str_) – The path to the nf-core pipeline directory. + +#### `failed{:python}` + +A list of tuples of the form: `(, )` + +- **Type:** + list + +#### `ignored{:python}` + +A list of tuples of the form: `(, )` + +- **Type:** + list + +#### `lint_config{:python}` + +The parsed nf-core linting config for this pipeline + +- **Type:** + dict + +#### `passed{:python}` + +A list of tuples of the form: `(, )` + +- **Type:** + list + +#### `release_mode{:python}` + +True, if you the to linting was run in release mode, False else. + +- **Type:** + bool + +#### `warned{:python}` + +A list of tuples of the form: `(, )` + +- **Type:** + list + +#### `_get_results_md(){:python}` + +Create a markdown file suitable for posting in a GitHub comment. + +- **Returns:** + Formatting markdown content +- **Return type:** + markdown (str) + +#### `_lint_pipeline() → None{:python}` + +Main linting function. + +Takes the pipeline directory as the primary input and iterates through +the different linting checks in order. Collects any warnings or errors +into object attributes: `passed`, `ignored`, `warned` and `failed`. + +#### `_print_results(show_passed, plain_text=False){:python}` + +Print linting results to the command line. + +Uses the `rich` library to print a set of formatted tables to the command line +summarising the linting results. + +#### `_save_json_results(json_fn){:python}` + +Function to dump lint results to a JSON file for downstream use + +- **Parameters:** + **json_fn** (_str_) – File path to write JSON to. + +#### `_wrap_quotes(files: list[str] | list[Path] | Path) → str{:python}` + +Helper function to take a list of filenames and format with markdown. + +- **Parameters:** + **files** (_list_) – + + List of filenames, eg: + + ```default + ['foo', 'bar', 'baz'] + ``` + +- **Returns:** + Formatted string of paths separated by word `or`, eg: + ```default + `foo` or bar` or `baz` + ``` +- **Return type:** + markdown (str) diff --git a/sites/docs/src/content/api_reference/dev/api/pipelines/lint_utils.md b/sites/docs/src/content/api_reference/dev/api/pipelines/lint_utils.md new file mode 100644 index 0000000000..ba916db529 --- /dev/null +++ b/sites/docs/src/content/api_reference/dev/api/pipelines/lint_utils.md @@ -0,0 +1,60 @@ +# nf_core.pipelines.utils + +### `nf_core.pipelines.lint_utils.check_git_repo() → bool{:python}` + +Check if the current directory is a git repository. + +### `nf_core.pipelines.lint_utils.dump_json_with_prettier(file_name, file_content){:python}` + +Dump a JSON file and run prettier on it. +:param file_name: A file identifier as a string or pathlib.Path. +:type file_name: Path | str +:param file_content: Content to dump into the JSON file +:type file_content: dict + +### `nf_core.pipelines.lint_utils.dump_yaml_with_prettier(file_name: Path | str, file_content: dict) → None{:python}` + +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]]{:python}` + +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){:python}` + +Prints available and applied fixes + +### `nf_core.pipelines.lint_utils.print_joint_summary(lint_obj, module_lint_obj, subworkflow_lint_obj, plain_text=False){:python}` + +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){:python}` + +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){:python}` + +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(file: Path | str | list[str]) → None{:python}` + +Run the pre-commit hook prettier on a file. + +- **Parameters:** + **file** (_Path_ _|_ _str_) – A file identifier as a string or pathlib.Path. +- **Warns:** + **If Prettier is not installed, a warning is logged.** diff --git a/sites/docs/src/content/api_reference/dev/api/pipelines/utils.md b/sites/docs/src/content/api_reference/dev/api/pipelines/utils.md deleted file mode 100644 index 8ae937bff0..0000000000 --- a/sites/docs/src/content/api_reference/dev/api/pipelines/utils.md +++ /dev/null @@ -1 +0,0 @@ -# nf_core.pipelines.utils diff --git a/sites/docs/src/content/api_reference/dev/api/utils.md b/sites/docs/src/content/api_reference/dev/api/utils.md index 351a648399..541a61485c 100644 --- a/sites/docs/src/content/api_reference/dev/api/utils.md +++ b/sites/docs/src/content/api_reference/dev/api/utils.md @@ -65,7 +65,7 @@ Force overwrite of existing files Whether the pipeline is an nf-core pipeline. -#### `model_config{:python}`_= {}_ +#### `model_config{:python}`_: ClassVar\[ConfigDict]_ _= {}_ Configuration for the model, should be a dictionary conforming to \[ConfigDict]\[pydantic.config.ConfigDict]. @@ -94,7 +94,7 @@ Output directory Pipeline version -### _`class{:python}`_`nf_core.utils.NFCoreYamlConfig(, repository_type: Literal['pipeline', 'modules'] | None = None, nf_core_version: str | None = None, org_path: str | None = None, lint:{:python}`[`NFCoreYamlLintConfig{:python}`](#nf_core.utils.NFCoreYamlLintConfig)`| None = None, template:{:python}`[`NFCoreTemplateConfig{:python}`](#nf_core.utils.NFCoreTemplateConfig)`| None = None, bump_version: dict[str, bool] | None = None, update: dict[str, str | bool | dict[str, str | dict[str, str | bool]]] | None = None){:python}` +### _`class{:python}`_`nf_core.utils.NFCoreYamlConfig(, repository_type: Literal['pipeline', 'modules'] | None = None, nf_core_version: str | None = None, org_path: str | None = None, lint:{:python}`[`NFCoreYamlLintConfig{:python}`](#nf_core.utils.NFCoreYamlLintConfig)`| None = None, template:{:python}`[`NFCoreTemplateConfig{:python}`](#nf_core.utils.NFCoreTemplateConfig)`| None = None, bump_version: dict[str, bool] | None = None, update: dict[str, str | bool | dict[str, str | dict[str, str | bool]]] | None = None, container_registry: list[str] | None = None){:python}` Bases: `BaseModel` @@ -109,6 +109,10 @@ Bases: `BaseModel` - **Type:** Disable bumping of the version for a module/subworkflow (when repository_type is modules). See https +#### `container_registry{:python}`_: list\[str] | None_ + +Additional container registry prefixes allowed when linting container directives. + #### `get(item: str, default: Any = None) → Any{:python}` #### `lint{:python}`_: [NFCoreYamlLintConfig](#nf_core.utils.NFCoreYamlLintConfig) | None_ @@ -118,7 +122,7 @@ Bases: `BaseModel` - **Type:** Pipeline linting configuration, see https -#### `model_config{:python}`_= {}_ +#### `model_config{:python}`_: ClassVar\[ConfigDict]_ _= {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}_ Configuration for the model, should be a dictionary conforming to \[ConfigDict]\[pydantic.config.ConfigDict]. @@ -263,7 +267,7 @@ Lint local components use correct structure mirroring remote List of files that should not contain merge markers -#### `model_config{:python}`_= {}_ +#### `model_config{:python}`_: ClassVar\[ConfigDict]_ _= {}_ Configuration for the model, should be a dictionary conforming to \[ConfigDict]\[pydantic.config.ConfigDict]. diff --git a/sites/docs/src/content/api_reference/dev/index.md b/sites/docs/src/content/api_reference/dev/index.md index 7f45b97c14..5b8f9e5fd2 100644 --- a/sites/docs/src/content/api_reference/dev/index.md +++ b/sites/docs/src/content/api_reference/dev/index.md @@ -8,3 +8,4 @@ This API documentation is for the [`nf-core/tools`](https://github.com/nf-core/t - [Module code lint tests](module_lint_tests/environment_yml) (run by `nf-core modules lint`) - [Subworkflow code lint tests](subworkflow_lint_tests/main_nf) (run by `nf-core subworkflows lint`) - [nf-core/tools Python package API reference](api/utils) +- [`.nf-core.yml` configuration reference](api/nf_core_yml) diff --git a/sites/docs/src/content/api_reference/dev/module_lint_tests/main_nf.md b/sites/docs/src/content/api_reference/dev/module_lint_tests/main_nf.md index dbaaefaf80..75f17125f2 100644 --- a/sites/docs/src/content/api_reference/dev/module_lint_tests/main_nf.md +++ b/sites/docs/src/content/api_reference/dev/module_lint_tests/main_nf.md @@ -1,6 +1,6 @@ # main_nf -#### `ModuleLint.main_nf(module: NFCoreComponent, fix_version: bool, registry: str, progress_bar: Progress) → tuple[list[str], list[str]]{:python}` +#### `ModuleLint.main_nf(module: NFCoreComponent, fix_version: bool, registry: tuple[str, ...], progress_bar: Progress) → tuple[list[str], list[str]]{:python}` Lint a `main.nf` module file diff --git a/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/actions_ci.md b/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/actions_ci.md deleted file mode 100644 index f6efdf6b91..0000000000 --- a/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/actions_ci.md +++ /dev/null @@ -1,36 +0,0 @@ -# actions_ci - -#### `PipelineLint.actions_ci(){:python}` - -Checks that the GitHub Actions pipeline CI (Continuous Integration) workflow is valid. - -The `.github/workflows/ci.yml` GitHub Actions workflow runs the pipeline on a minimal test -dataset using `-profile test` to check that no breaking changes have been introduced. -Final result files are not checked, just that the pipeline exists successfully. - -This lint test checks this GitHub Actions workflow file for the following: - -- Workflow must be triggered on the following events: - ```yaml - on: - push: - branches: - - dev - pull_request: - release: - types: [published] - ``` -- The minimum Nextflow version specified in the pipeline’s `nextflow.config` matches that defined by `NXF_VER` in the test matrix: - - ```yaml - strategy: - matrix: - # Nextflow versions: check pipeline minimum and current latest - NXF_VER: ["19.10.0", ""] - ``` - - :::note - These `matrix` variables run the test workflow twice, varying the `NXF_VER` variable each time. - This is used in the `nextflow run` commands to test the pipeline with both the latest available version - of the pipeline (`''`) and the stated minimum required version. - ::: diff --git a/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/nfcore_yml.md b/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/nfcore_yml.md index 5c740ae4e1..cc89afd887 100644 --- a/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/nfcore_yml.md +++ b/sites/docs/src/content/api_reference/dev/pipeline_lint_tests/nfcore_yml.md @@ -6,7 +6,7 @@ Repository `.nf-core.yml` tests The `.nf-core.yml` contains metadata for nf-core tools to correctly apply its features. -- repository type: +- `repository_type`: > Check that the repository type is set. -- nf core version: +- `nf_core_version`: > Check if the nf-core version is set to the latest version.