<commit_before>package config

import (
	"errors"
	"fmt"
	"reflect"
	"strings"

	"github.com/concourse/atc"
	"github.com/concourse/turbine"
)

type InvalidConfigError struct {
	GroupsErr    error
	ResourcesErr error
	JobsErr      error
}

func (err InvalidConfigError) Error() string {
	errorMsg := "invalid configration:\n"

	if err.GroupsErr != nil {
		errorMsg += indent(fmt.Sprintf("invalid groups:\n%s\n", indent(err.GroupsErr.Error())))
	}

	if err.ResourcesErr != nil {
		errorMsg += indent(fmt.Sprintf("invalid resources:\n%s\n", indent(err.ResourcesErr.Error())))
	}

	if err.JobsErr != nil {
		errorMsg += indent(fmt.Sprintf("invalid jobs:\n%s\n", indent(err.JobsErr.Error())))
	}

	return errorMsg
}

func indent(msgs string) string {
	lines := strings.Split(msgs, "\n")
	indented := make([]string, len(lines))<commit_msg>better validator error message formatting<commit_after>package config

import (
	"errors"
	"fmt"
	"reflect"
	"strings"

	"github.com/concourse/atc"
	"github.com/concourse/turbine"
)

type InvalidConfigError struct {
	GroupsErr    error
	ResourcesErr error
	JobsErr      error
}

func (err InvalidConfigError) Error() string {
	errorMsgs := []string{"invalid configration:"}

	if err.GroupsErr != nil {
		errorMsgs = append(errorMsgs, indent(fmt.Sprintf("invalid groups:\n%s\n", indent(err.GroupsErr.Error()))))
	}

	if err.ResourcesErr != nil {
		errorMsgs = append(errorMsgs, indent(fmt.Sprintf("invalid resources:\n%s\n", indent(err.ResourcesErr.Error()))))
	}

	if err.JobsErr != nil {
		errorMsgs = append(errorMsgs, indent(fmt.Sprintf("invalid jobs:\n%s\n", indent(err.JobsErr.Error()))))
	}

	return strings.Join(errorMsgs, "\n")
}

func indent(msgs string) string {
	lines := strings.Split(msgs, "\n")
	indented := make([]string, len(lines))
{'fraction_non_alphanumeric': 0.15833801235261089, 'fraction_numerical': 0.0, 'mean_word_length': 4.785714285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4357071', 'n_tokens_mistral': 642, 'n_tokens_neox': 621, 'n_words': 125}