About line endings
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- git, visualbasic
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu bằng cách đọc .gitattributes hiện tại của repository và thay đổi về ký tự xuống dòng từ PR 43. So sánh các cách tiếp cận được đề xuất là -text, filter/.gitconfig và GitHub Action, sau đó xác minh hành vi đã chọn đối với các tệp VBA nhận được thông qua việc clone, tải xuống archive và tải xuống tệp raw của GitHub. Công việc được xem là hoàn tất khi cách tiếp cận được chọn đã được dokument hóa và các tệp VBA được import chính xác vào VBE.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I notice that in this PR https://github.com/Beakerboy/VBA-SQL-Library/pull/43, you added a .gitattributes file that makes it so that line endings are converted to LF in the Git index.
I've personally read in a few places that it was a good practice as well, but I've recently come to the conclusion that normalizing line endings to LF for VBA files doesn't actually bring any value because GitHub is already smart enough to deal with CRLF line endings.
The problem with eol=clrf is that the conversion to CRLF only occurs when someone clones the repo or downloads it as a .zip file. GitHub won't make the line ending conversion when someone downloads a single file using the "Download raw file" option in the GitHub interface.
Then, people that don't know about this problem will inevitably try to down a single file from the project and get an error when trying to import it in the VBE. For example: https://github.com/VBA-tools/VBA-Dictionary/issues/38
For that reason and because there is no known advantages to convert to LF, I'd suggest to change the .gitattributes file to avoid applying line conversion.
Potential approaches
- Mark the vba files with
-textto avoid line endings conversion.
This is the simplest way to avoid most problems. The only downside of this approach is that it doesn't stop anyone from uploading a file with LF.
- Approach 1 + Use a filter to force the conversion to CRLF.
This approach is particularily useful if you make edits via VScode and don't what to introduce LF by mistake. However, it requires contributors to run a command to inlcude the .gitconfig to their local config.
For example:
.gitattributes:
# By default, auto detect text files and perform LF normalization
* text=auto eol=lf
# Important: To make sure the crlf filter is active, run the following command at the root of the git repo: git config include.path ../.gitconfig
# (The reason why we need the ".." is to move one folder up because the config file is located in the .git subfolder.)
# VBA extensions - Enforce CRLF using a filter
*.[bB][aA][sS] filter=crlf -text working-tree-encoding=CP1252
*.[cC][lL][sS] filter=crlf -text working-tree-encoding=CP1252
*.[fF][rR][mM] filter=crlf -text working-tree-encoding=CP1252
*.[vV][bB][aA] filter=crlf -text working-tree-encoding=CP1252
# VBA extensions - Mark as binary
*.[fF][rR][xX] binary
.gitconfig:
[filter "crlf"]
clean = unix2dos
- Use a GitHub Action to enforce CRLF
This would be the only full proof method to maintain consitent line endings.
I think that would be a good thing to add this option to https://github.com/Vba-actions/lint-vba. I might actually have some python code I could contribute if you are interested to add this feature.
- Ngôn ngữ chính
- VBA
- Star
- 90
- Fork
- 18
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Beakerboy/VBA-SQL-Library
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
Beakerboy/VBA-SQL-Library#68 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
Beakerboy/VBA-SQL-Library#67 ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 52/100
Beakerboy/VBA-SQL-Library#66 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
Beakerboy/VBA-SQL-Library#65 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
Beakerboy/VBA-SQL-Library#64 ·
Tất cả issue của Beakerboy/VBA-SQL-Library
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
use-agent-os/agent-os#3314 ·
-
Implement GitHub Issue templates Đang mởdocumentation low-priority templates
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
jesseray718/openroot#87 ·
-
factory-active factory-automatic task-bug-reproduction-cannot-reproduce task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
danielmiessler/LifeOS#2218 ·
-
in-progress proposal
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
uibcdf/molsyssuite#36 ·