nf-core / nf-core/tools

Consider enforcing line feeds in .gitattributes

Open Beginner friendly
#4,341 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

Description of feature

Enforce line feeds in .gitattributes using settings such as

* text eol=lf

to prevent corruption by core.autocrlf settings.

Background

I recently ran into an edge case likely caused by a misconfigured core.autocrlf setting in git while running nf-core/mag (see the original issue here: https://github.com/nf-core/mag/issues/1050). This caused line endings in a python script to be converted to CRLF in the working tree when nextflow pulled the pipeline (apparently the global git settings apply to nextflow pulls). If the pipeline is run with the apptainer profile (although this might apply to other profiles as well), this corrupts the shebang #!/usr/bin/env python and causes the apptainer to crash. Manual CRLF to LF conversion in the cached repository using dos2unix fixed this issue.

Settings in the .gitattributes file can be used to overrule core.autocrlf to force git (and by extension nextflow) to checkout to LF line endings, preventing this issue.

While this is an edge case, I do not see a scenario in which forced LF line endings would cause issues and therefore request the .gitattributes file be changed accordingly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the repository's .gitattributes file and Git's line-ending behavior, especially with core.autocrlf enabled. Update the attributes so checked-out text files consistently use LF, then verify the file change and confirm that the configuration covers the affected Python scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
developer-experience
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.