loader/loader.go

Summary

Maintainability
B
4 hrs
Test Coverage

Function LoadFile has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func LoadFile(path string, override *config.Override) (*config.Config, error) {
    overridePaths, err := getOverridePaths()
    if err != nil {
        return nil, fmt.Errorf(
            "failed to determine override paths: %s",
Severity: Minor
Found in loader/loader.go - About 1 hr to fix

    Function LoadFile has 9 return statements (exceeds 4 allowed).
    Open

    func LoadFile(path string, override *config.Override) (*config.Config, error) {
        overridePaths, err := getOverridePaths()
        if err != nil {
            return nil, fmt.Errorf(
                "failed to determine override paths: %s",
    Severity: Major
    Found in loader/loader.go - About 55 mins to fix

      Method Loader.readOverride has 6 return statements (exceeds 4 allowed).
      Open

      func (l *Loader) readOverride(path string) (*config.Override, error) {
          if override, ok := l.loadedOverrides[path]; ok {
              return override, nil
          }
      
      
      Severity: Major
      Found in loader/loader.go - About 40 mins to fix

        Method Loader.readConfigs has 5 return statements (exceeds 4 allowed).
        Open

        func (l *Loader) readConfigs(path string) error {
            if _, ok := l.loadedConfigs[path]; ok {
                return nil
            }
        
        
        Severity: Major
        Found in loader/loader.go - About 35 mins to fix

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

          func validateConfig(path string, data []byte) error {
              if err := schema.Validate("schema/config.yaml", data); err != nil {
                  return fmt.Errorf("failed to validate config %s: %s", path, err.Error())
              }
          
          
          Severity: Major
          Found in loader/loader.go - About 35 mins to fix

            Method Loader.Load has 5 return statements (exceeds 4 allowed).
            Open

            func (l *Loader) Load(path string) (*config.Config, error) {
                path = l.normalizePath(path, "")
            
                if err := l.readConfigs(path); err != nil {
                    return nil, err
            Severity: Major
            Found in loader/loader.go - About 35 mins to fix

              exported type Loader should have comment or be unexported
              Open

                  Loader struct {
              Severity: Minor
              Found in loader/loader.go by golint

              exported method Loader.LoadPathSubstitutions should have comment or be unexported
              Open

              func (l *Loader) LoadPathSubstitutions(overridePaths []string) error {
              Severity: Minor
              Found in loader/loader.go by golint

              exported function NewLoader should have comment or be unexported
              Open

              func NewLoader() *Loader {
              Severity: Minor
              Found in loader/loader.go by golint

              exported method Loader.Load should have comment or be unexported
              Open

              func (l *Loader) Load(path string) (*config.Config, error) {
              Severity: Minor
              Found in loader/loader.go by golint

              exported function LoadFile should have comment or be unexported
              Open

              func LoadFile(path string, override *config.Override) (*config.Config, error) {
              Severity: Minor
              Found in loader/loader.go by golint

              exported method Loader.ApplyOverrides should have comment or be unexported
              Open

              func (l *Loader) ApplyOverrides(config *config.Config, overridePaths []string) error {
              Severity: Minor
              Found in loader/loader.go by golint

              There are no issues that match your filters.

              Category
              Status