Show error message when test fails to complete, disable errcheck temporarily

This commit is contained in:
Herman Schaaf
2016-08-03 13:55:59 +08:00
parent d7ca2b113b
commit 442efa217e
4 changed files with 32 additions and 19 deletions

View File

@@ -97,6 +97,11 @@
margin-top: 1em;
font-weight: 600;
}
.results-details .error-msg {
margin-top: 1em;
font-weight: 600;
color: #C6761E;
}
#badge_dropdown {
position: absolute;
top: 40px;

View File

@@ -18,7 +18,7 @@ func (c ErrCheck) Weight() float64 {
// Percentage returns the percentage of .go files that pass gofmt
func (c ErrCheck) Percentage() (float64, []FileSummary, error) {
return GoTool(c.Dir, c.Filenames, []string{"gometalinter", "--deadline=180s", "--disable-all", "--enable=errcheck"})
return GoTool(c.Dir, c.Filenames, []string{"gometalinter", "--deadline=180s", "--disable-all", "--linter='errch:errcheck {path}:PATH:LINE:MESSAGE'", "--enable=errch"})
}
// Description returns the description of gofmt

View File

@@ -67,6 +67,7 @@ type score struct {
FileSummaries []check.FileSummary `json:"file_summaries"`
Weight float64 `json:"weight"`
Percentage float64 `json:"percentage"`
Error string `json:"error"`
}
type checksResp struct {
@@ -185,15 +186,17 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
check.License{Dir: dir, Filenames: []string{}},
check.Misspell{Dir: dir, Filenames: filenames},
check.IneffAssign{Dir: dir, Filenames: filenames},
check.ErrCheck{Dir: dir, Filenames: filenames},
// check.ErrCheck{Dir: dir, Filenames: filenames}, // disable errcheck for now, too slow and not finalized
}
ch := make(chan score)
for _, c := range checks {
go func(c check.Check) {
p, summaries, err := c.Percentage()
errMsg := ""
if err != nil {
log.Printf("ERROR: (%s) %v", c.Name(), err)
errMsg = err.Error()
}
s := score{
Name: c.Name(),
@@ -201,6 +204,7 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
FileSummaries: summaries,
Weight: c.Weight(),
Percentage: p,
Error: errMsg,
}
ch <- s
}(c)

View File

@@ -149,6 +149,9 @@
<div class="wrapper">
<a name="{{{name}}}"></a><h1 class="tool-title">{{{name}}}<span class="percentage {{color percentage}}">{{percentage}}%</span></h1>
<p class="tool-description">{{{description}}}</p>
{{#if error}}
<p class="error-msg">An error occurred while running this test ({{error}})</p>
{{else}}
{{^file_summaries}}
<p class="perfect">No problems detected. Good job!</p>
{{/file_summaries}}
@@ -166,6 +169,7 @@
</li>
</ul>
{{/each}}
{{/if}}
</div>
<hr>
</script>