pedroMMM/goss

View on GitHub

Showing 33 of 439 total issues

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

func DetectDistro() string {
    if b, e := ioutil.ReadFile("/etc/lsb-release"); e == nil && bytes.Contains(b, []byte("Ubuntu")) {
        return "ubuntu"
    } else if isRedhat() {
        return "redhat"
Severity: Major
Found in system/system.go - About 40 mins to fix

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

    func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
        id := res.ID()
        title := res.GetTitle()
        meta := res.GetMeta()
        typ := reflect.TypeOf(res)
    Severity: Major
    Found in resource/validate.go - About 40 mins to fix

      Function ValidateContains has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
      Severity: Minor
      Found in resource/validate.go - About 35 mins to fix

        Function AddResource has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func AddResource(fileName string, gossConfig GossConfig, resourceName, key string, config util.Config, sys *system.System) error {
        Severity: Minor
        Found in add.go - About 35 mins to fix

          Function ValidateValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
          Severity: Minor
          Found in resource/validate.go - About 35 mins to fix

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

            func NewTemplateFilter(varsFile string, varsInline string) (func([]byte) ([]byte, error), error) {
                vars, err := loadVars(varsFile, varsInline)
                if err != nil {
                    return nil, fmt.Errorf("failed while loading vars file %q: %v", varsFile, err)
                }
            Severity: Major
            Found in template.go - About 35 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

                Method DefFile.Filetype has 5 return statements (exceeds 4 allowed).
                Open

                func (f *DefFile) Filetype() (string, error) {
                    if err := f.setup(); err != nil {
                        return "", err
                    }
                
                
                Severity: Major
                Found in system/file.go - About 35 mins to fix

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

                  func toVersions(in interface{}) ([]*semver.Version, bool) {
                      if v, ok := toVersion(in); ok {
                          return []*semver.Version{v}, ok
                      }
                  
                  
                  Severity: Major
                  Found in matchers/semver_constraint.go - About 35 mins to fix

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

                    func shouldSkip(results []TestResult) bool {
                        if len(results) < 1 {
                            return false
                        }
                        if results[0].Err != nil {
                    Severity: Major
                    Found in resource/resource.go - About 35 mins to fix

                      Method ResourceTypeMap.UnmarshalYAML has 5 return statements (exceeds 4 allowed).
                      Open

                      func (ret *ResourceTypeMap) UnmarshalYAML(unmarshal func(v interface{}) error) error {
                          // Validate configuration
                          zero := ResourceType{}
                          whitelist, err := util.WhitelistAttrs(zero, util.YAML)
                          if err != nil {
                      Severity: Major
                      Found in resource/resource_list_genny.go - About 35 mins to fix

                        Method MatchingMap.UnmarshalYAML has 5 return statements (exceeds 4 allowed).
                        Open

                        func (ret *MatchingMap) UnmarshalYAML(unmarshal func(v interface{}) error) error {
                            // Validate configuration
                            zero := Matching{}
                            whitelist, err := util.WhitelistAttrs(zero, util.YAML)
                            if err != nil {
                        Severity: Major
                        Found in resource/matching.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
                            Severity
                            Category
                            Status
                            Source
                            Language