Esempio n. 1
0
// cmdRun runs all the enabled checks.
func (a *application) cmdRun(repo scm.ReadOnlyRepo, modes []checks.Mode, against string, prereqReady *sync.WaitGroup) error {
	var err error
	var old scm.Commit
	if against != "" {
		if old = repo.Eval(against); old == scm.Invalid {
			return errors.New("invalid commit 'against'")
		}
	} else {
		if old = repo.Eval(string(scm.Upstream)); old == scm.Invalid {
			return errors.New("no upstream")
		}
	}
	change, err := repo.Between(scm.Current, old, a.config.IgnorePatterns)
	if err != nil {
		return err
	}
	return a.runChecks(change, modes, prereqReady)
}
Esempio n. 2
0
// cmdRun runs all the enabled checks.
func cmdRun(repo scm.ReadOnlyRepo, config *checks.Config, modes []checks.Mode, against string, prereqReady *sync.WaitGroup) error {
	var err error
	var old scm.Commit
	if against != "" {
		if old, err = repo.Eval(against); err != nil {
			return err
		}
	} else {
		if old, err = repo.Upstream(); err != nil {
			return err
		}
	}
	change, err := repo.Between(scm.Current, old, config.IgnorePatterns)
	if err != nil {
		return err
	}
	return runChecks(config, change, modes, prereqReady)
}