Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow mixed str and dict in lint config #3228

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

mashehu
Copy link
Contributor

@mashehu mashehu commented Oct 17, 2024

we should probably rewrite this into a TypedDict or similar in the future.

@Joon-Klaps
Copy link
Contributor

Could you write a quick test for this as well?

Copy link
Contributor

@Joon-Klaps Joon-Klaps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried my best but am not entirely following with all changes due to a lack of knowledge on the codebase of nf-tools.
Tested it also again on my pipeline & new failed tests were popping up because actions_ci was not included in the class NFCoreYamlLintConfig(BaseModel

Comment on lines +89 to +91
assert len(results.get("failed", [])) == 0
assert len(results.get("warned", [])) == 0
assert len(results.get("ignored", [])) == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can these be all equal to 0? I would assume that we would have some ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only lint the .nf-core.yml file here, so the above settings don't ignore anything there.

nf_core/utils.py Outdated
Comment on lines 1124 to 1135
files_unchanged: Union[bool, List[str]] = []
""" List of files that should not be changed """
modules_config: Optional[Union[bool, List[str]]] = []
""" List of modules that should not be changed """
merge_markers: Optional[Union[bool, List[str]]] = []
""" List of files that should not contain merge markers """
nextflow_config: Optional[Union[bool, List[Union[str, Dict[str, List[str]]]]]] = []
""" List of Nextflow config files that should not be changed """
multiqc_config: Union[bool, List[str]] = []
""" List of MultiQC config options that be changed """
files_exist: Union[bool, List[str]] = []
""" List of files that can not exist """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not all optional?
For instance, I can imagine. multiqc_config being absent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional here, means that it can be of the given type or None and because we give them a default value != None, there is no need for that.

""" List of files that can contain template strings """
nfcore_components: Optional[bool] = None
""" Include all required files to use nf-core modules and subworkflows """

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would double check docs for some that you have missed.

  • actions_ci
  • actions_aws*
  • ...

Or are they not necessary?
https://nf-co.re/tools/docs/latest/pipeline_lint_tests/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@mashehu mashehu added the WIP Work in progress label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants