Intellij 不斷spotbugs.yml錯誤地格式化我的檔案,因此破壞了 github 操作。
我無法弄清楚它為什么這樣做:

上周作業正常,我沒有對格式化配置進行任何更改,但現在,每次我從檔案中更改焦點時,Intellij 都會像這樣自動格式化,然后保存它。我該如何解決?
我不明白的是它的格式似乎是無效的yaml,對吧?
uj5u.com熱心網友回復:
YAML 的語法使其與非 2 個空格的縮進不兼容。有 4 個空格,您有:
droggel:
jug:
- sequence item: with indentation
this line: isn't aligned to four spaces
nor are further indented lines:
if you indent relative four spaces
spam:
- same: problem
without: indenting the sequence item
這使得代碼格式化程式很難正確處理。正確對齊意味著:
droggel:
jug:
- three spaces after the sequence item indicator.
that's horrible, nobody does that.
spam:
- alternatively this.
nobody does this either and it breaks
- - with nested sequences
我假設 IntelliJ 中的一些錯誤導致格式化程式因此而感到困惑。通常最好只使用 2 個空格縮進,由于上述問題,這看起來更自然。這應該避免混淆格式化程式。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/429736.html
