About line endings
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- git, visualbasic
- 領域
- tooling
調査の方向性
まず、リポジトリの現在の .gitattributes と、PR 43 における行末の変更を読みます。提案されている -text、filter/.gitconfig、GitHub Action のアプローチを比較し、続いて、クローン、アーカイブのダウンロード、GitHub の raw ファイルのダウンロードによって取得した VBA ファイルについて、選択した動作を検証します。選択したアプローチが文書化され、VBA ファイルを VBE に正しくインポートできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- VBA
- スター
- 90
- フォーク
- 18
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Beakerboy/VBA-SQL-Library のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
Beakerboy/VBA-SQL-Library#68 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
Beakerboy/VBA-SQL-Library#67 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 52/100
Beakerboy/VBA-SQL-Library#66 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
Beakerboy/VBA-SQL-Library#65 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
Beakerboy/VBA-SQL-Library#64 ·
Beakerboy/VBA-SQL-Library の issue をすべて見る
似ている issue
-
react-doctor severity:warning tech-debt
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
digidem/comapeo-cloud-app#418 ·
メンテナーはふだん 1 日以内に返信