pedroMMM/goss

View on GitHub
store.go

Summary

Maintainability
A
2 hrs
Test Coverage

Function RenderJSON has 6 return statements (exceeds 4 allowed).
Open

func RenderJSON(c *RuntimeConfig) (string, error) {
    var err error
    debug = c.Debug
    currentTemplateFilter, err = NewTemplateFilter(c.Vars, c.VarsInline)
    if err != nil {
Severity: Major
Found in store.go - About 40 mins to fix

    Function mergeJSONData has 6 return statements (exceeds 4 allowed).
    Open

    func mergeJSONData(gossConfig GossConfig, depth int, path string) (GossConfig, error) {
        depth++
        if depth >= 50 {
            return GossConfig{}, fmt.Errorf("max depth of 50 reached, possibly due to dependency loop in goss file")
        }
    Severity: Major
    Found in store.go - About 40 mins to fix

      Function varsFromFile has 5 return statements (exceeds 4 allowed).
      Open

      func varsFromFile(varsFile string) (map[string]interface{}, error) {
          vars := make(map[string]interface{})
          if varsFile == "" {
              return vars, nil
          }
      Severity: Major
      Found in store.go - About 35 mins to fix

        Function WriteJSON has 5 return statements (exceeds 4 allowed).
        Open

        func WriteJSON(filePath string, gossConfig GossConfig) error {
            jsonData, err := marshal(gossConfig)
            if err != nil {
                return fmt.Errorf("failed to write %s: %s", filePath, err)
            }
        Severity: Major
        Found in store.go - About 35 mins to fix

          exported type TmplVars should have comment or be unexported
          Open

          type TmplVars struct {
          Severity: Minor
          Found in store.go by golint

          exported method TmplVars.Env should have comment or be unexported
          Open

          func (t *TmplVars) Env() map[string]string {
          Severity: Minor
          Found in store.go by golint

          exported function WriteJSON should have comment or be unexported
          Open

          func WriteJSON(filePath string, gossConfig GossConfig) error {
          Severity: Minor
          Found in store.go by golint

          exported const UNSET should have comment (or a comment on this block) or be unexported
          Open

              UNSET = iota
          Severity: Minor
          Found in store.go by golint

          comment on exported function RenderJSON should be of the form "RenderJSON ..."
          Open

          // Reads json file recursively returning string
          Severity: Minor
          Found in store.go by golint

          There are no issues that match your filters.

          Category
          Status