ENT-14151: Formatted with cfengine format and added GH Action to check formatting#146
Conversation
Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
Ticket: ENT-14151 Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
larsewi
left a comment
There was a problem hiding this comment.
Comments are out of place many places
craigcomstock
left a comment
There was a problem hiding this comment.
I see you fixed the placement of the comments. Is there a way to fix cfengine format to keep the comments with the code they are "after on the same line" as in this case?
| # NOTKEPT if unable to fetch rss, unable to re-write content | ||
| feed => "https://blogs.nasa.gov/stationreport/feed/", | ||
| select => "oldest"; # Default to newest | ||
| select => "oldest"; |
There was a problem hiding this comment.
Seems wrong that the formatter threw away this comment?
There was a problem hiding this comment.
Oh. It pushed it down to the next block. Curious.
There was a problem hiding this comment.
did it? Here it looks to me like it moved it before the feed attribtue
There was a problem hiding this comment.
@nickanderson look at the commits, I moved it manually in a separate commit.
@craigcomstock I think you already asked about this a few weeks ago? It's intended behavior. The formatter doesn't know about the placement of anything. It parses a whole file into a syntax tree and then renders the syntax tree. Everything lands in a deterministic place, regardless of how it was placed between whitespace characters in the input. If we were going to "fix" this, we'd have to change the parser so it generates different types of comments. There are a few drawbacks to that and I'm not convinced the benefit of allowing people to place comments in different places is worth it. |
It makes sense to me that a comment after an attribute on the same line belongs with that promise and not the next promise. But this is a comment on the formatter not this reformat here. All good! :) |
|
It seems like comments after attributes move inconsistently? Here it moved below the attribute on the next line: #146 (comment) Here it moved before the promise? #146 (review) |
@nickanderson no, please look at the commits. |
Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
No description provided.