Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

File terminators not enforced as LF, CRLF can sneak in but should be disallowed

Open mikehardy opened this issue 1 month ago • 6 comments

Checked for duplicates?

  • [X] This issue is not a duplicate

Does it also happen in the desktop version?

  • [X] This bug does not occur in the latest version of Anki

What are the steps to reproduce this bug?

Search code tree for CRLF terminators, or attempt to commit a file that has them:

mike@isabela:~/work/ankidroid/Anki-Android/AnkiDroid/src (main) % for FILE in `find . |grep '\.kt'`; do file $FILE |grep CRLF; done
./androidTest/java/com/ichi2/anki/ReviewerTest.kt: ASCII text, with CRLF line terminators
./test/java/com/ichi2/anki/previewer/PreviewerViewModelTest.kt: ASCII text, with CRLF line terminators
./test/java/com/ichi2/anki/ConstantUniquenessTest.kt: ASCII text, with CRLF line terminators
./main/java/com/ichi2/anki/preferences/AccessibilitySettingsFragment.kt: ASCII text, with CRLF line terminators
./main/java/com/ichi2/anki/pages/ImageOcclusion.kt: ASCII text, with CRLF line terminators

Expected behaviour

There should be no CRLF terminators in the files in the project, additionally, if you attempt to commit any our ktlint rules should fix them and worst case if you commit them anyway it should fail CI via a lint-rules check

Additionally I believe it is possible for git to be configured such that it attempts to fix these as well ?

Actual behaviour

CRLF will happily just go right into the tree

Debug info

doesn't matter as it is infrastructure in the project (ktlint, lint-rules, git settings, etc)

but it's happening as of this typing which is commit hash 74feec0a3dd157d9c3a332f6a3819d2a9154effc which is current main as of June 3rd 2024 @ 11:34a UTC-5

(Optional) Anything else you want to share?

No response

Research

  • [X] I am reporting a bug specific to AnkiDroid (Android app)
  • [X] I have checked the manual and the FAQ and could not find a solution to my issue
  • [X] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)

mikehardy avatar Jun 03 '24 16:06 mikehardy