Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the Jackson Yaml linter removes code comments #1795

Open
6 tasks
bnorman405 opened this issue Aug 30, 2023 · 6 comments
Open
6 tasks

the Jackson Yaml linter removes code comments #1795

bnorman405 opened this issue Aug 30, 2023 · 6 comments
Labels

Comments

@bnorman405
Copy link

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
@aldex32
Copy link

aldex32 commented Oct 8, 2023

Any plan to fix this?

@henrikcaesar
Copy link

henrikcaesar commented Oct 20, 2023

This is perhaps related to FasterXML/jackson-dataformats-text#36 and in the end SnakeYaml?

@OksiBlack
Copy link

OksiBlack commented Nov 3, 2023

This is really unfortunate bug, I am considering the removal of yaml step because of it.

@nedtwigg nedtwigg added the bug label Nov 16, 2023
@asomov
Copy link

asomov commented Feb 15, 2024

@henrikcaesar SnakeYAML supports the comments.

@tim-oe
Copy link

tim-oe commented Jul 4, 2024

+100 for fix.i lost a lot of info when running this....

@blacelle
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants