Skip to content

Commit

Permalink
add filenames to linting
Browse files Browse the repository at this point in the history
RULE                           TYPE    FILENAME                    LINE    MESSAGE
replicas-1                     info    cron-deployment.yaml        11      Found Replicas 1
replicas-1                     info    redis-deployment-2.yaml     12      Found Replicas 1
replicas-1                     info    web-deployment.yaml         11      Found Replicas 1
container-resources            info    init-job.yaml               16      Missing container resources
container-resources            info    redis-deployment-2.yaml     24      Missing container resources
container-resources            info    redis-statefulset.yaml      24      Missing container resources
container-resources            info    usercreate-job.yaml         16      Missing container resources
container-resource-limits      info    postgres-deployment.yaml    63      Missing resource limits
may-contain-secrets            info    redis-secret.yaml           9       It looks like there might be secrets in this file
  • Loading branch information
dexhorthy committed Feb 27, 2020
1 parent 7bc18af commit a7e5ab5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cli/print/lint.go
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/replicatedhq/replicated/pkg/types"
)

var lintTmplSrc = `RULE TYPE LINE MESSAGE
var lintTmplSrc = `RULE TYPE FILENAME LINE MESSAGE
{{ range . -}}
{{ .Rule }} {{ .Type }} {{with .Positions}}{{ (index . 0).Start.Line }}{{else}} {{end}} {{ .Message}}
{{ .Rule }} {{ .Type }} {{ .Path }} {{with .Positions}}{{ (index . 0).Start.Line }}{{else}} {{end}} {{ .Message}}
{{ end }}`

var lintTmpl = template.Must(template.New("lint").Parse(lintTmplSrc))
Expand Down
2 changes: 1 addition & 1 deletion client/release.go
Expand Up @@ -160,7 +160,7 @@ func (c *Client) PromoteRelease(appID string, appType string, sequence int64, la
func (c *Client) LintRelease(appID string, appType string, yamlOrJSON string) ([]types.LintMessage, error) {

if appType == "platform" {
return nil, errors.New("Linting is not yet supported for Platform applications")
return nil, errors.New("Linting is not yet supported in this CLI, please install github.com/replicatedhq/replicated-lint to lint this application")
// return c.PlatformClient.LintRelease(appID, yamlOrJSON)
} else if appType == "ship" {
return c.ShipClient.LintRelease(appID, yamlOrJSON)
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/release.go
Expand Up @@ -15,12 +15,13 @@ type ReleaseInfo struct {
type LintMessage struct {
Rule string `json:"rule"`
Type string `json:"type"`
Path string `json:"path"`
Message string `json:"message"`
Positions []*LintPosition `json:"positions"`
}

type LintPosition struct {
Path string `json:"path"`
Path string `json:"path"`
Start LintLinePosition `json:"start"`
End LintLinePosition `json:"end"`
}
Expand Down

0 comments on commit a7e5ab5

Please sign in to comment.