zeek / zeek/zeekscript

Extraneous space inserted after trailing comma

Open
#63 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

In many places Zeek allows trailing commas. This seems to be handled inconsistently.

For enums I see expected behavior:

type E: enum { a, b, c, };

For set-like constructs I see an additional space:

const s = { 1, 2, 3,  };
#                    ^

const r: RecordType = [ $a=1, $b=2, $c=3,  ];
#                                         ^

We probably have the same issue for function-like constructors, e.g.,

const a = vector(1, 2, 3, );
#                        ^

The issue seems to be that we insert an space after , in the contexts even though it is not followed by more arguments.

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 by locating the formatter entry points for enum, set-like, record, and vector constructs, then inspect how trailing commas are rendered. Reproduce the examples from the issue and compare each output with the enum behavior. Done means trailing commas are preserved without an extra space when no following argument exists, with coverage for the listed constructs.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.