Open slonka opened 2 weeks ago
It would be good. I'm a little curious on the feasability. Also there are yaml parsers (yq is one of them) which preserves comments. Wondering if there is such a thing on ruby
Maybe https://github.com/jim80net/yq ?
triage: we should check if the builtin ruby YAML parser doesn't allow preserving comments
Description
Now when we parse the yaml in
policy_yaml
it will remove the comments. One simple trick that we could do to preserve them would be to create a map like this:and after all the modifications are done reapply the comments by searching the map for the same line and a closeby
line_number
. E.g.:would create a map like:
and then we would reapply this comment somewhere near 20 line (let's say [15, 25]) to lines that match
match:
. WDYT?