mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
Show error message when test fails to complete, disable errcheck temporarily
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -149,23 +149,27 @@
|
||||
<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>
|
||||
{{^file_summaries}}
|
||||
<p class="perfect">No problems detected. Good job!</p>
|
||||
{{/file_summaries}}
|
||||
{{#each file_summaries}}
|
||||
<ul class="files">
|
||||
<li class="file">
|
||||
<ul class="errors">
|
||||
<a href="{{this.file_url}}">{{this.filename}}</a>
|
||||
{{#each this.errors}}
|
||||
{{#if line_number}}
|
||||
<li class="error"><a href="{{../../file_url}}#L{{this.line_number}}">Line {{this.line_number}}</a>: {{this.error_string}}</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{{/each}}
|
||||
{{#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}}
|
||||
{{#each file_summaries}}
|
||||
<ul class="files">
|
||||
<li class="file">
|
||||
<ul class="errors">
|
||||
<a href="{{this.file_url}}">{{this.filename}}</a>
|
||||
{{#each this.errors}}
|
||||
{{#if line_number}}
|
||||
<li class="error"><a href="{{../../file_url}}#L{{this.line_number}}">Line {{this.line_number}}</a>: {{this.error_string}}</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<hr>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user