SimonBaeumer/goss

View on GitHub

Showing 157 of 157 total issues

Function createServeCommand has 63 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func createServeCommand() cli.Command {
return cli.Command{
Name: "serve",
Aliases: []string{"s"},
Usage: "Serve a health endpoint",
Severity: Minor
Found in cmd/goss/goss.go - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func (f *DefFile) Md5() (string, error) {
     
    if err := f.setup(); err != nil {
    return "", err
    }
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 244..262

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    func (f *DefFile) Sha256() (string, error) {
     
    if err := f.setup(); err != nil {
    return "", err
    }
    Severity: Major
    Found in system/file.go and 1 other location - About 1 hr to fix
    system/file.go on lines 224..242

    Function validateHeader has 61 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func validateHeader(res ResourceRead, property string, expectedHeaders map[string][]string, actualHeaders system.Header, skip bool) TestResult {
    id := res.ID()
    title := res.GetTitle()
    meta := res.GetMeta()
    typ := reflect.TypeOf(res)
    Severity: Minor
    Found in resource/http.go - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (f *DefFile) Owner() (string, error) {
      if err := f.setup(); err != nil {
      return "", err
      }
       
       
      Severity: Major
      Found in system/file.go and 1 other location - About 1 hr to fix
      system/file.go on lines 169..185

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (f *DefFile) Group() (string, error) {
      if err := f.setup(); err != nil {
      return "", err
      }
       
       
      Severity: Major
      Found in system/file.go and 1 other location - About 1 hr to fix
      system/file.go on lines 151..167

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *ServiceSystemd) Running() (bool, error) {
      if invalidService(s.service) {
      return false, nil
      }
      cmd := util.NewCommand("systemctl", "-q", "is-active", s.service)
      Severity: Major
      Found in system/service_systemd.go and 1 other location - About 1 hr to fix
      system/service_systemd.go on lines 41..56

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *ServiceSystemd) Enabled() (bool, error) {
      if invalidService(s.service) {
      return false, nil
      }
      cmd := util.NewCommand("systemctl", "-q", "is-enabled", s.service)
      Severity: Major
      Found in system/service_systemd.go and 1 other location - About 1 hr to fix
      system/service_systemd.go on lines 58..73

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func getGroupForGid(gid int) (string, error) {
      if group, err := user.LookupGid(gid); err == nil {
      return group.Name, nil
      }
       
       
      Severity: Major
      Found in system/file.go and 1 other location - About 1 hr to fix
      system/file.go on lines 264..276

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func getUserForUid(uid int) (string, error) {
      if user, err := user.LookupUid(uid); err == nil {
      return user.Name, nil
      }
       
       
      Severity: Major
      Found in system/file.go and 1 other location - About 1 hr to fix
      system/file.go on lines 278..290

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func NewGroup(sysGroup system.Group, config util.Config) (*Group, error) {
      groupname := sysGroup.Groupname()
      exists, _ := sysGroup.Exists()
      g := &Group{
      Groupname: groupname,
      Severity: Major
      Found in resource/group.go and 2 other locations - About 1 hr to fix
      resource/package.go on lines 38..51
      resource/port.go on lines 37..50

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func NewPort(sysPort system.Port, config util.Config) (*Port, error) {
      port := sysPort.Port()
      listening, _ := sysPort.Listening()
      p := &Port{
      Port: port,
      Severity: Major
      Found in resource/port.go and 2 other locations - About 1 hr to fix
      resource/group.go on lines 40..53
      resource/package.go on lines 38..51

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func NewPackage(sysPackage system.Package, config util.Config) (*Package, error) {
      name := sysPackage.Name()
      installed, _ := sysPackage.Installed()
      p := &Package{
      Name: name,
      Severity: Major
      Found in resource/package.go and 2 other locations - About 1 hr to fix
      resource/group.go on lines 40..53
      resource/port.go on lines 37..50

      Function ValidateContains has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
      Open

      func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
      format.TruncatedDiff = false
      id := res.ID()
      title := res.GetTitle()
      meta := res.GetMeta()
      Severity: Minor
      Found in resource/validate.go - About 1 hr to fix

      Function skipResult has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func skipResult(typeS string, testType int, id string, title string, meta meta, property string, startTime time.Time) TestResult {
      Severity: Major
      Found in resource/validate.go - About 50 mins to fix

        Method KernelParamMap.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
        Open

        func (ret *KernelParamMap) UnmarshalJSON(data []byte) error {
        // Curried json.Unmarshal
        unmarshal := func(i interface{}) error {
        if err := json.Unmarshal(data, i); err != nil {
        return err
        Severity: Major
        Found in resource/resource_list.go - About 45 mins to fix

          Method GossfileMap.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
          Open

          func (ret *GossfileMap) UnmarshalJSON(data []byte) error {
          // Curried json.Unmarshal
          unmarshal := func(i interface{}) error {
          if err := json.Unmarshal(data, i); err != nil {
          return err
          Severity: Major
          Found in resource/resource_list.go - About 45 mins to fix

            Method InterfaceMap.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
            Open

            func (ret *InterfaceMap) UnmarshalJSON(data []byte) error {
            // Curried json.Unmarshal
            unmarshal := func(i interface{}) error {
            if err := json.Unmarshal(data, i); err != nil {
            return err
            Severity: Major
            Found in resource/resource_list.go - About 45 mins to fix

              Method ServiceMap.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
              Open

              func (ret *ServiceMap) UnmarshalJSON(data []byte) error {
              // Curried json.Unmarshal
              unmarshal := func(i interface{}) error {
              if err := json.Unmarshal(data, i); err != nil {
              return err
              Severity: Major
              Found in resource/resource_list.go - About 45 mins to fix

                Method HTTPMap.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
                Open

                func (ret *HTTPMap) UnmarshalJSON(data []byte) error {
                // Curried json.Unmarshal
                unmarshal := func(i interface{}) error {
                if err := json.Unmarshal(data, i); err != nil {
                return err
                Severity: Major
                Found in resource/resource_list.go - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language