Intellij总是错误地格式化我的spotbugs.yml
文件,因此破坏了github操作。
我搞不懂它为什么要这么做
它上周运行良好,我没有对格式化配置做任何更改,但是现在,每次我从Intellij自动格式文件中更改焦点时,都会保存它。我怎么才能修好它?
我不明白的是,它的格式显示为无效的yaml
,对吗?
发布于 2022-02-21 12:41:35
YAML的语法使得它与缩进不兼容,而缩进不是两个空格。有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://stackoverflow.com/questions/71204763
复制相似问题