redpanda-data / redpanda-data/benthos

Enhance linter errors for invalid root-level 'if` statements

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

Nobody has claimed this yet.

bloblang needs investigation
Dominant language
Go
Stars
571
Forks
120
Avg merge
2d 1h
Merged PRs (30d)
18

Description

Linting the following bloblang mapping:

if true { 
  deleted() 
} else {
  root.foo = 42
} 

produces the following error:

Input
Output
failed to parse mapping: line 4 char 12: required: expected }
  |
4 |   root.foo = 42
  |            ^---

Not sure if it's possible to enhance it without a breaking change though, because I think root = is implicit when there's no else clause (i.e. if true { deleted() })

Contributor guide

Open the contributing guide

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 reproducing the provided Bloblang mapping and trace the parser or linter path that reports the error at line 4. The work is done when invalid root-level if statements receive a more useful diagnostic while preserving the stated implicit root assignment behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
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.