Use tabs for indentation in embedded JSON#6103
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6103 +/- ##
=======================================
Coverage 31.66% 31.66%
=======================================
Files 420 420
Lines 28413 28413
=======================================
Hits 8996 8996
Misses 18596 18596
Partials 821 821 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This shouldnt be any problem. Embedded templates should use the common indentation of the target language in case of json this shoulf stay as spaces. |
|
what IDE do you use? |
|
I use Kate (KDE's text editor), does this work with different editors? The editor can't know which file type this if it does not analyze the content itself. and this would also only work for common types. |
What does "work" means here? I can open the files in vscode/codium and auto-formatting on safe also works. |
|
By "work" I mean what happens when editing this embedded JSON data. Kate uses tabs then (obviously because the rest of the file uses tabs), while most lines use spaces. Yes, it works correctly for the Go code in the file. There already were many inconsistencies in the JSON, likely happened due to this issue. I don't think any editor handles this. |
|
Correct you have to manually indent it. Feel free to switch to tabs for this particular case but thats not a global solution. In the autoscaler for example we had the same issue with the embedded cloudinit config but cloudinit is picky and fails on tab indened files. The best approach would be to use |
|
For larger files yes, embedding is best, but having a new file for every 3-line json seems a bit overkill to me. I can change it though if you prefer that way |
|
Also fine for me to go with this PR. Just wanted to say, this will not work in all cases and will not be enforced by linters etc. so we will end up with a mixed result again. |
|
So can we merge this then? |
My editor (and I guess any other also) is not working properly otherwise.