Skip to content

Reformatted standalone policy files with cfengine format#3675

Open
olehermanse wants to merge 3 commits into
cfengine:masterfrom
olehermanse:master
Open

Reformatted standalone policy files with cfengine format#3675
olehermanse wants to merge 3 commits into
cfengine:masterfrom
olehermanse:master

Conversation

@olehermanse

Copy link
Copy Markdown
Member

No description provided.

@olehermanse

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

@olehermanse olehermanse changed the title cfengine format Reformatted standalone policy files with cfengine format Jun 1, 2026
@olehermanse olehermanse requested review from craigcomstock and nickanderson and removed request for craigcomstock June 1, 2026 23:08
@olehermanse olehermanse marked this pull request as ready for review June 1, 2026 23:08
@olehermanse

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

@craigcomstock craigcomstock left a 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.

I understand that comment placement is tricky so am approving this PR even though I found several places that seem to need more work to transition from old policy to formatted policy with comments.

Comment thread content/examples/example-snippets/linking_files.cf Outdated
Comment thread content/resources/additional-topics/STIGs.cf Outdated
Comment thread content/resources/additional-topics/STIGs.cf Outdated
Comment thread content/resources/additional-topics/STIGs.cf Outdated
Comment thread content/resources/additional-topics/STIGs.cf Outdated
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
@olehermanse

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

@olehermanse olehermanse force-pushed the master branch 3 times, most recently from 45bf592 to 26f7337 Compare June 8, 2026 13:25
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
Generally we should avoid commented out code;
- It's not checked for syntax errors.
- It will become outdated.
- It is often not clear why it was there or why it was commented out.
- It adds noise for the person reading the rest of the file.

If you absolutely want to make a block of commented out code, you should
keep these things in mind and probably:
- Add comments to overcommunicate and make it very clear what it is and
  why it was commented out.
- Add some tickets / TODOs for how we want to address it in the future.

Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>

@nickanderson nickanderson left a comment

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.

I don't really have a strong opinion about the line suffixed comments moving before/after. I think before makes a bit more sense, but after really isn't the end of the world.

# The back reference in a path only applies to the last link
# of the pathname, so the (tmp) gets ignored
"/tmp/(cf3)_(.*)" edit_line => myedit("second $(match.2)");
# but ...

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.

Why did these comments bump out? Shouldn't #but ... and the others below be aligned with the comments before the promise since we are still inside the files promise block?

replace_value => "/* $(match.1) */"; # backreference 0
occurrences => "all"; # first, last all
replace_value => "/* $(match.1) */";
# backreference 0

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.

Shouldn't these line suffix comments move to the line prior?

create => "true",
edit_defaults => empty_file, # defined in stdlib
edit_line => create_solaris_admin_file; # defined in stdlib
# empty_file and create_solaris_admin_file are defined in stdlib:

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.

I'm impressed that the format command constructed that from #defined in stdlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants