Update .gitattributes to prefer LF#12816
Conversation
See test results for failed build of commit cbce460fa3 |
|
Git for Windows has a feature to fiddle with line endings at checkout and commit time I believe. Won't this conflict with that? |
f6da480 to
123c3ae
Compare
This should remain compatible with |
|
Did you update the readme.md with the recommanded configuration? Sorry, I've not been able to find it in a such big number of modified files because I do not know how to view a specific modified file in GitHub. |
There's no real recommended configuration for I plan on adding
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
123c3ae to
cb81c5d
Compare
cb81c5d to
a5810c7
Compare
|
@feerrenrut @michaelDCurran Any ideas on how we can confirm that normalizing the line endings won't affect translators? Otherwise, this PR is ready to be reviewed then merged with the strategy outlined in the PR description. |
This comment has been minimized.
This comment has been minimized.
See test results for failed build of commit eb6e6aa1aa |
|
Thanks @michaelDCurran - I've updated the testing steps and confirmed that the pot file is unchanged (other than the metadata eg commit info and generation time). |
This comment has been minimized.
This comment has been minimized.
|
@seanbudd When you do that diff of the pot files, ensure that the line endings were considered and not ignored by the diff tool. It may be more certain to inspect an entry in the file manually with |
feerrenrut
left a comment
There was a problem hiding this comment.
I hope you don't mind I've updated the description to add a numbered lists for the stages of the change. It currently talks about 3 commits in this PR which is a little confusing.
How will the PR's be updated to resolve the diff? Each PR will have to have normalize run on it and a new commit pushed, right?
I've confirmed this and updated the testing steps.
Thanks, this is much easier to read.
I've created #12864 to investigate and discuss this. In short - yes. |
62b2420 to
46c0bee
Compare
WalkthroughThe update introduces enhanced documentation and guidelines for using the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
6167ba7 to
3fb0c8c
Compare
3fb0c8c to
ff61724
Compare
|
@coderabbitai full review |
There was a problem hiding this comment.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
projectDocs/dev/codingStandards.md (1)
Line range hint
21-86: Refine and approve the guidelines on indentation and identifier names.The guidelines on indentation and identifier names are well-defined and promote readability and maintainability. However, the repetition of the word 'should' in the section on Enums could be addressed to enhance readability.
- Enums should be formatted using the expected mix of above eg: + Enums should be formatted using the expected mix of the above guidelines, for example:Tools
LanguageTool
[duplication] ~21-~21: Possible typo: you repeated a word
Context: ...t-Configuration#_core_autocrlf).Indentation
- Indentation must be done with tabs (one per level),...
(ENGLISH_WORD_REPEAT_RULE)
See test results for failed build of commit be214c00b5 |
Follow up to #12816 Closes #12387 Must be merge commit Performed the following: git add --renormalize . git commit -m "normalize line endings" Added the commit to .git-blame-ignore-revs Testing Confirmed testing by ensuring the diff is empty git diff --ignore-cr-at-eol origin/master normalize-all-line-endings
Link to issue number:
Part of #12387
Summary of the issue:
The NVDA code base uses a mix of CRLF and LF style line endings, with the preference being CRLF.
LF style endings have been introduced prior to lint checking, and can causes issues when moving code or making changes.
Many IDEs will normalize the line endings when editing files, causing larger than intended diffs of files with mixed line endings.
Instead, we should normalize all line endings of text files to LF and ensure that all files are committed with LF line endings.
Specific files should be excluded from normalization such as:
git allows independent configurations between line endings used when a developer checkouts out code locally, and when code is committed to a repository.
IDEs are often better suited for different line endings, with LF line endings becoming more and more standardised.
However, NVDA is Windows based development, where CRLF line ending usage is commonly default or compulsory.
Developers can checkout code locally, using whatever line endings they prefer or their IDE requires, using
git config.core autocrlf.We can configure what line endings we commit to the repository with
.gitattributes.This is set on a repository level.
As what line endings we commit with is agnostic to what is checked out, the decision is based on what works best for the repository.
Unix style line endings usage and support continues to increase on Windows and LF files.
LF tends to be better supported by Unix style developer tools such as git.
LF uses less data than CRLF.
Additional information: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
Description of how this pull request fixes the issue:
Fixing this is a 3 step process, this PR emulates the 3 steps, but only one commit should be merged at a time.
Otherwise, new PRs will have large diffs due to line ending changes.
.git-blame-ignore-revsfile so that the normalization commit can be ignored by developers usinggit blame.Specifically this PR:
.gitattributesfile, witheol=lfand normalization patterns for each file type NVDA uses:-textorbinaryfor no normalizationtextto change line endings tolfwhen committing code.git add --renormalize .sets the correct line endings for the entire project.Testing strategy:
Setup
normalize-line-endingsas follows to perform this testing.Update
.git-blame-ignore-revswith the latest commit.Compare the diff while ignoring eol line changes
Check the blame of a file from this branch and confirm the line ending changes show up in the blame.
Then check the blame of a file:
Test that
.git-blame-ignore-revsworks and ignores the line ending changes.Test that setting
.git-blame-ignore-revsworks.This should be recommended to devs.
Test that committing a text file, not used by the translation system, with CRLF line endings is not possible.
This can be done by adding or changing a file.
Test that the resulting translation .pot files generated do not change after nomalization.
Note: Not git diff, as these files are ignored. Update the commits within the file names if required.
cat -AdisplaysCRas^M. This will ensure the diff tool picks up on any CRLF changes.Known issues with pull request:
None
Change log entries:
N/A
Code Review Checklist:
Summary by CodeRabbit
Documentation
git-blame-ignore-revsfeature.codingStandards.mdwith new file encoding and line ending practices, naming conventions, and docstring format specifications.Chores
.gitattributesto seteol=lf, define text attributes for various file types, and specify files exempt from renormalization.