cucumber / changelog

Read, validate and manipulate CHANGELOG.md files that follow keepachangelog.com specification
MIT License
2 stars 1 forks source link

Parser breaks on cucumber-jvm's changelog #8

Open mattwynne opened 2 years ago

mattwynne commented 2 years ago

👓 What did you see?

When we tried to parse cucumber-jvm's changelog we got a failure:

https://github.com/cucumber/cucumber-jvm/runs/5588154935?check_suite_focus=true

➜  cucumber-jvm git:(release-automation) changelog latest
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x10309a960]

goroutine 1 [running]:
github.com/cucumber/changelog/parser.(*renderer).ListItem(0x14000140660, 0x1031b90c8, 0x1400011c210, 0x140002b2140, 0x1, 0x1)
    /Users/matt/git/github.com/cucumber/changelog/parser/parser.go:189 +0x110
github.com/cucumber/changelog/parser.(*renderer).RenderNode(0x14000140660, 0x1031b90c8, 0x1400011c210, 0x140002b2140, 0x14000071a01, 0x103095f0c)
    /Users/matt/git/github.com/cucumber/changelog/parser/parser.go:84 +0xd4
github.com/russross/blackfriday/v2.Run.func1(0x140002b2140, 0x103094101, 0x1)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/russross/blackfriday/v2@v2.1.0/markdown.go:392 +0x58
github.com/russross/blackfriday/v2.(*Node).Walk(0x14000158640, 0x14000071b70)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/russross/blackfriday/v2@v2.1.0/node.go:290 +0x58
github.com/russross/blackfriday/v2.Run(0x1400027e000, 0x2539e, 0x26000, 0x1400017fc28, 0x2, 0x2, 0x0, 0x0, 0x0)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/russross/blackfriday/v2@v2.1.0/markdown.go:391 +0x1bc
github.com/cucumber/changelog/parser.Parse(0x1031b9068, 0x14000140600, 0x1400017fd58)
    /Users/matt/git/github.com/cucumber/changelog/parser/parser.go:26 +0x15c
github.com/cucumber/changelog/cmd.newLatestCmd.func1(0x14000163680, 0x10330cd18, 0x0, 0x0, 0x0, 0x0)
    /Users/matt/git/github.com/cucumber/changelog/cmd/latest.go:18 +0x38
github.com/spf13/cobra.(*Command).execute(0x14000163680, 0x10330cd18, 0x0, 0x0, 0x14000163680, 0x10330cd18)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x320
github.com/spf13/cobra.(*Command).ExecuteC(0x1032dab20, 0x200000003, 0x14000000180, 0x14000000180)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/matt/.asdf/installs/golang/1.16.6/packages/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/cucumber/changelog/cmd.Execute()
    /Users/matt/git/github.com/cucumber/changelog/cmd/root.go:85 +0x30
main.main()
    /Users/matt/git/github.com/cucumber/changelog/main.go:6 +0x20

✅ What did you expect to see?

Ideally handle the file format and parse it, but at least throw a meaningful error to say what's wrong with it.

📦 Which version are you using?

Latest development head.

🔬 How could we reproduce it?

Grab https://github.com/cucumber/cucumber-jvm/blob/42b4251ad4589cdadabffcfd0c2a7b450dbf3897/CHANGELOG.md and try to run any changelog command on it.

mattwynne commented 2 years ago

Rien has worked around this problem in the cucumber-jvm project by breaking the CHANGELOG up into smaller files. There may still be some academic interest here in using that big CHANGELOG to flush out some bugs in this tool