qax-os / goreporter

A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Apache License 2.0
3.13k stars 273 forks source link

Invalid javascript in generated html #48

Closed ostronom closed 6 years ago

ostronom commented 7 years ago

The generated HTML document (with default template) is generated with an invalid javascript.

Uncaught SyntaxError: Unexpected token N in JSON at position 41
    at JSON.parse (<anonymous>)
    at Object.1../subpage/codeCount.js (dialog-platform-2017-11-09-17-55-01.html:879)
    at s (dialog-platform-2017-11-09-17-55-01.html:877)
    at e (dialog-platform-2017-11-09-17-55-01.html:877)
    at dialog-platform-2017-11-09-17-55-01.html:877
wgliang commented 7 years ago

Can you give wrong details, such as html files or screenshots? Then we will deal with it.

ostronom commented 7 years ago

Here is the final file. dialog-platform-2017-11-09-18-12-10.html.zip

bnkamalesh commented 6 years ago

@wgliang I have the same issue too. For me, the error is at resData.gotest = JSON.parse(resData.gotest). Probably when there are no tests?

Edit: attaching a file generated for my app. The app runs fine, but goreporter throws errors saying some packages are not found. Command used to generate report: goreporter -p . -r ~/work/goreports -e vendor -f html File attached. report.zip

wgliang commented 6 years ago

I've got it.This is because a divide by 0 operation causes NaN. Thx everyone!