You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
the Jackson Yaml linter removes code comments #1795
If you are submitting a bug, please include the following:
summary of problem
using spotlessApply with a the jackson yaml package included removes lines in yaml files that start with #.
gradle or maven version
gradle 7.5
spotless version
6.21.0
operating system and version
osx Ventura
copy-paste your full Spotless configuration block(s)
spotless {
java {
palantirJavaFormat()
// Added target as spotless was having problems with the groovy files.
target(project.fileTree(project.rootDir) {
include 'src//java/**/.java'
// Excluded Controller because spotless is making it very hard to read.
exclude '/Controller.java'
})
}
json {
target(
'.cicd//.json',
'.primer/**/.json',
'src//.json'
)
gson().indentWithSpaces(2)
}
groovy {
importOrder('', 'spock')
excludeJava(true)
}
yaml {
target 'src//.yml', 'src/**/.yaml'
jackson().yamlFeature('MINIMIZE_QUOTES', true)
}
}
copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace
no errors
@blacelle, it seems they implemented minimal support for YAML comments last week and closed the mentioned threads.
Not sure if now this means it can also be implemented here.
This change comes with Jackson 3.2, which should not be a big issue given Spotless classpath management, and fact is Jackson3.X has different namespace than Jackson 2.X.
Activity
aldex32 commentedon Oct 8, 2023
Any plan to fix this?
henrikcaesar commentedon Oct 20, 2023
This is perhaps related to FasterXML/jackson-dataformats-text#36 and in the end SnakeYaml?
OksiBlack commentedon Nov 3, 2023
This is really unfortunate bug, I am considering the removal of yaml step because of it.
asomov commentedon Feb 15, 2024
@henrikcaesar SnakeYAML supports the comments.
tim-oe commentedon Jul 4, 2024
+100 for fix.i lost a lot of info when running this....
blacelle commentedon Sep 10, 2024
The lack of proper comments management in yaml was initially discussed in #910, and discussed with Jackson team in FasterXML/jackson-dataformats-text#372, itself referring FasterXML/jackson-dataformats-text#36 which is still open and active.
One may consider contributing a SnakeYAML linter (vs current Jackson linter, based on SnakeYAML).
MarcoMartins86 commentedon Apr 14, 2026
@blacelle, it seems they implemented minimal support for YAML comments last week and closed the mentioned threads.
Not sure if now this means it can also be implemented here.
blacelle commentedon Apr 15, 2026
This change comes with Jackson 3.2, which should not be a big issue given Spotless classpath management, and fact is Jackson3.X has different namespace than Jackson 2.X.