zeek / zeek/zeekscript

Empty line before comment should (sometimes) be preserved

Open
#91 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11
Forks
4
Avg merge
3d 19h
Merged PRs (30d)
1

Description

Currently zeek-format removes empty lines before any minor comments, e.g.,

event new_event(name: string, params: call_argument_vector)
	{
	print name;
	}

# Should preserve empty line before.

first gets formatted to

event new_event(name: string, params: call_argument_vector)
	{
	print name;
	}

	# Should preserve empty line.

and then again (breaking idempotency) to

event new_event(name: string, params: call_argument_vector)
	{
	print name;
	}
	# Should preserve empty line.

I would have expect this to not change formatting at all.

zeek-format should still remove empty after e.g., { (comment first node in block).

Labelling as bug due to idempotency breaking.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with zeek-format's handling of empty lines before minor comments, comparing comments after a completed event with comments that are the first node after {. Confirm that formatting the example preserves the blank line and that formatting the result again is unchanged, while blank lines immediately after { are still removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.