forked from forgejo/forgejo
Rename scripts to build and add revive command as a new build tool command (#10942)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
4af7c47b38
commit
4f63f283c4
182 changed files with 15832 additions and 1226 deletions
40
vendor/github.com/mgechev/revive/formatter/json.go
generated
vendored
Normal file
40
vendor/github.com/mgechev/revive/formatter/json.go
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
package formatter
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/mgechev/revive/lint"
|
||||
)
|
||||
|
||||
// JSON is an implementation of the Formatter interface
|
||||
// which formats the errors to JSON.
|
||||
type JSON struct {
|
||||
Metadata lint.FormatterMetadata
|
||||
}
|
||||
|
||||
// Name returns the name of the formatter
|
||||
func (f *JSON) Name() string {
|
||||
return "json"
|
||||
}
|
||||
|
||||
// jsonObject defines a JSON object of an failure
|
||||
type jsonObject struct {
|
||||
Severity lint.Severity
|
||||
lint.Failure `json:",inline"`
|
||||
}
|
||||
|
||||
// Format formats the failures gotten from the lint.
|
||||
func (f *JSON) Format(failures <-chan lint.Failure, config lint.Config) (string, error) {
|
||||
var slice []jsonObject
|
||||
for failure := range failures {
|
||||
obj := jsonObject{}
|
||||
obj.Severity = severity(config, failure)
|
||||
obj.Failure = failure
|
||||
slice = append(slice, obj)
|
||||
}
|
||||
result, err := json.Marshal(slice)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(result), err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue