Skip to content

ENT-14151: Formatted with cfengine format and added GH Action to check formatting#146

Merged
olehermanse merged 3 commits into
cfengine:masterfrom
olehermanse:master
Jun 1, 2026
Merged

ENT-14151: Formatted with cfengine format and added GH Action to check formatting#146
olehermanse merged 3 commits into
cfengine:masterfrom
olehermanse:master

Conversation

@olehermanse
Copy link
Copy Markdown
Member

@olehermanse olehermanse commented Jun 1, 2026

No description provided.

Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
Ticket: ENT-14151
Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are out of place many places

Comment thread inventory/inventory-fwupd/policy.cf Outdated
Comment thread security/delete-home-dotrhosts/policy/main.cf Outdated
Comment thread security/delete-home-dotshosts/policy/main.cf Outdated
Comment thread security/install-aide/install-aide.cf Outdated
Comment thread security/inventory-selinux-modules/main.cf Outdated
Comment thread security/uninstall-apache/uninstall-apache.cf Outdated
Comment thread security/uninstall-rsh-server/uninstall-rsh-server.cf Outdated
Comment thread security/uninstall-samba/uninstall-samba.cf Outdated
Comment thread security/uninstall-squid/uninstall-squid.cf Outdated
Copy link
Copy Markdown
Contributor

@craigcomstock craigcomstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread examples/rss/rss.cf
# 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";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems wrong that the formatter threw away this comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. It pushed it down to the next block. Curious.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it? Here it looks to me like it moved it before the feed attribtue

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickanderson look at the commits, I moved it manually in a separate commit.

@olehermanse
Copy link
Copy Markdown
Member Author

olehermanse commented Jun 1, 2026

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?

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

@craigcomstock
Copy link
Copy Markdown
Contributor

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?

@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 policy 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! :)

@olehermanse olehermanse requested a review from larsewi June 1, 2026 13:07
Comment thread security/inventory-selinux-modules/main.cf Outdated
Comment thread security/inventory-selinux-modules/main.cf Outdated
@nickanderson
Copy link
Copy Markdown
Member

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)

@olehermanse
Copy link
Copy Markdown
Member Author

olehermanse commented Jun 1, 2026

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]>
@olehermanse olehermanse merged commit ce9719c into cfengine:master Jun 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants