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

replace editorconfig by pre-commit-hooks #3467

Merged
merged 3 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .editorconfig

This file was deleted.

25 changes: 19 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,26 @@ repos:
- id: prettier
additional_dependencies:
- prettier@3.5.0

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "3.2.0"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: editorconfig-checker
alias: ec

- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: |
(?x)^(
.*\.snap$|
nf_core/pipeline-template/subworkflows/.*|
nf_core/pipeline-template/modules/.*|
tests/pipelines/__snapshots__/.*
)$
- id: end-of-file-fixer
exclude: |
(?x)^(
.*\.snap$|
nf_core/pipeline-template/subworkflows/.*|
nf_core/pipeline-template/modules/.*|
tests/pipelines/__snapshots__/.*
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like we need to also exclude main.nf in modules and subworkflow template files

Copy link
Member Author

Choose a reason for hiding this comment

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

I think modifying the template is good, no? What we should skip are the modules and subworkflows because they are handeled in the module repo

Copy link
Contributor

Choose a reason for hiding this comment

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

i am just wondering about the introduced changes... how come they were not there with editorconfig?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't see anywhere where we excluded these files... but I have tested creating a new pipeline and running pre-commit there and everything passes.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, fine for me then. 🙂

)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.15.0"
hooks:
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ tests/data/pipeline_create_template_skip.yml
# don't run on things handled by ruff
*.py
*.pyc

5 changes: 5 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
printWidth: 120
tabWidth: 4
overrides:
- files: "*.{md,yml,yaml,html,css,scss,js,cff}"
options:
tabWidth: 2
2 changes: 1 addition & 1 deletion nf_core/assets/logo/placeholder_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 0 additions & 41 deletions nf_core/pipeline-template/.editorconfig

This file was deleted.

24 changes: 19 additions & 5 deletions nf_core/pipeline-template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@ repos:
- id: prettier
additional_dependencies:
- prettier@3.5.0

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "3.2.0"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: editorconfig-checker
alias: ec
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: |
(?x)^(
.*ro-crate-metadata.json$|
modules/nf-core/.*|
subworkflows/nf-core/.*|
.*\.snap$
)$
- id: end-of-file-fixer
exclude: |
(?x)^(
.*ro-crate-metadata.json$|
modules/nf-core/.*|
subworkflows/nf-core/.*|
.*\.snap$
)$
5 changes: 5 additions & 0 deletions nf_core/pipeline-template/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
printWidth: 120
tabWidth: 4
overrides:
- files: "*.{md,yml,yaml,html,css,scss,js,cff}"
options:
tabWidth: 2
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,4 @@ def methodsDescriptionText(mqc_methods_yaml) {

return description_html.toString()
}
{% endif %}
{%- endif %}
3 changes: 0 additions & 3 deletions nf_core/pipelines/create/template_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ is_nfcore:
custom_pipelines: False
code_linters:
skippable_paths:
- ".editorconfig"
- ".pre-commit-config.yaml"
- ".prettierignore"
- ".prettierrc.yml"
Expand All @@ -180,11 +179,9 @@ code_linters:
The available code linters are:

- pre-commit (https://pre-commit.com/): used to run all code-linters on every PR and on ever commit if you run `pre-commit install` to install it in your local repository.
- editor-config (https://github.com/editorconfig-checker/editorconfig-checker): checks rules such as indentation or trailing spaces.
- prettier (https://github.com/prettier/prettier): enforces a consistent style (indentation, quoting, line length, etc).
linting:
files_exist:
- ".editorconfig"
- ".prettierignore"
- ".prettierrc.yml"
nfcore_pipelines: False
Expand Down
2 changes: 0 additions & 2 deletions nf_core/pipelines/lint/files_exist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def files_exist(self) -> Dict[str, List[str]]:
.gitattributes
.gitignore
.nf-core.yml
.editorconfig
.prettierignore
.prettierrc.yml
.github/.dockstore.yml
Expand Down Expand Up @@ -128,7 +127,6 @@ def files_exist(self) -> Dict[str, List[str]]:
[Path(".gitattributes")],
[Path(".gitignore")],
[Path(".nf-core.yml")],
[Path(".editorconfig")],
[Path(".prettierignore")],
[Path(".prettierrc.yml")],
[Path("CHANGELOG.md")],
Expand Down
1 change: 0 additions & 1 deletion nf_core/subworkflow-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ workflow {{ component_name_underscore|upper }} {

versions = ch_versions // channel: [ versions.yml ]
}

1 change: 0 additions & 1 deletion tests/data/testdata_remote_containers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
These entries should not be used:
On October 5, 2011, the 224-meter containership MV Rena struck a reef close to New Zealand’s coast and broke apart. That spells disaster, no?
MV Rena

1 change: 0 additions & 1 deletion tests/pipelines/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def test_pipeline_creation_with_yml_skip(self, tmp_path):
assert not (pipeline.outdir / "CODE_OF_CONDUCT.md").exists()
assert not (pipeline.outdir / ".github").exists()
assert not (pipeline.outdir / "conf" / "igenomes.config").exists()
assert not (pipeline.outdir / ".editorconfig").exists()

def test_template_customisation_all_files_grouping(self):
"""Test that all pipeline template files are included in a pipeline customisation group."""
Expand Down
Loading