-
Notifications
You must be signed in to change notification settings - Fork 22
/
bugreport.js
57 lines (49 loc) · 1.79 KB
/
bugreport.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var bugBaseUrl = "https://github.com/koalaman/shellcheck";
function makeReportUrl(script, json) {
var title = "TODO: Add title";
var template =
"#### For bugs\n" +
"- Rule Id (if any, e.g. SC1000): %ERRORS%\n" +
"- My shellcheck version (`shellcheck --version` or 'online'): online\n" +
"- [x] I tried on shellcheck.net and verified that this is still a problem on the latest commit\n" +
"- [ ] It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue\n" +
"\n" +
"#### For new checks and feature suggestions\n" +
"- [x] shellcheck.net (i.e. the latest commit) currently gives no useful warnings about this\n" +
"- [ ] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related\n" +
"\n" +
"\n" +
"#### Here's a snippet or screenshot that shows the problem:\n" +
"\n" +
"```sh\n" +
"%SCRIPT%\n" +
"```\n" +
"\n" +
"#### Here's what shellcheck currently says:\n" +
"```\n" +
"%ACTUAL%\n" +
"```\n" +
"#### Here's what I wanted or expected to see:\n" +
"\n" +
"TODO: Describe expected/desired output\n" +
"\n";
var errors = json.map(function (x) { return "SC" + x.code; }).join(", ");
var actual = json.map(function (x) {
return "Line " + x.line +"\tSC" + x.code + ": " + x.message;
}).join("\n");
if (script == "") {
script = "#!/your/shebang\nYour script";
actual = "TODO: Describe current output";
}
var body = template
.replace("%SCRIPT%", script)
.replace("%ERRORS%", errors)
.replace("%ACTUAL%", actual);
return newIssueUrl(bugBaseUrl, title, body);
}
function newIssueUrl(base, title, body) {
var url = base + "/issues/new?" +
// "title=" + encodeURIComponent(title) +
"body=" + encodeURIComponent(body) ;
return url;
}