~hristoast/openmw-validator

ab8a92fbbb3d0dd470478cbda926ac783ee2e979 — Hristos N. Triantafillou a month ago 7fbe6e0 0.7.1
Only exit nonzero when there's a problem
2 files changed, 9 insertions(+), 4 deletions(-)

M main.go
M validations.go
M main.go => main.go +2 -2
@@ 34,7 34,7 @@ func main() {
		defer file.Close()
		log.SetOutput(file)

		runValidations(runCfg)
		problems := runValidations(runCfg)

		msPerSec := 1000
		secPerMin := 60


@@ 67,7 67,7 @@ func main() {
			fmt.Printf("Validation completed, log written to: %s\n", runCfg.log)
		}

		if runCfg.exitNonZero {
		if runCfg.exitNonZero && problems {
			os.Exit(1)
		}
	}

M validations.go => validations.go +7 -2
@@ 19,7 19,7 @@ func sanitizePath(path string, prefix string) string {

// Given the raw cfg data and program config, do validating on the cfg file (and
// all related work).
func runValidations(runCfg *runConfig) {
func runValidations(runCfg *runConfig) bool {
	log.Println("Welcome to the OpenMW validator!")
	log.Printf("Validating file: %s", runCfg.cfg)
	contentFileCount := 1


@@ 43,7 43,7 @@ func runValidations(runCfg *runConfig) {

	if len(d.contentFiles) == 0 || len(d.dataPaths) == 0 {
		log.Println("No valid data or content was found in the given cfg file!")
		return
		return false
	}

	if !runCfg.quiet {


@@ 215,9 215,12 @@ func runValidations(runCfg *runConfig) {
		log.Println()
	}

	var haveProblems bool
	if !haveBadPaths && !haveEmptyPaths && !haveDupedPaths && !haveBunkContent && !haveBunkGroundcover && !haveFullyReplaced {
		log.Println("Great Job! No problems detected.")
		log.Println()
	} else {
		haveProblems = true
	}

	if runCfg.checkPath != "" {


@@ 265,4 268,6 @@ func runValidations(runCfg *runConfig) {
	//TODO: Tests for everything
	//TODO: Read .bsa files(?)
	//TODO: do we care about case-sensitivity? Maybe log those matches

	return haveProblems
}