// Check to see if there is a *revel.Validation as an argument.
180120
func getValidationParameter(funcDecl *ast.FuncDecl, imports map[string]string) *ast.Object {
	for _, field := range funcDecl.Type.Params.List {
		starExpr, ok := field.Type.(*ast.StarExpr) // e.g. *revel.Validation
		if !ok {
			continue
		}

		selExpr, ok := starExpr.X.(*ast.SelectorExpr) // e.g. revel.Validation
		if !ok {
			continue
		}

		xIdent, ok := selExpr.X.(*ast.Ident) // e.g. rev
		if !ok {
			continue
		}

		if selExpr.Sel.Name == "Validation" && imports[xIdent.Name] == model.RevelImportPath {
			return field.Names[0].Obj
		}
	}
	return nil
}
89281
func IsInvalidAction(err error) bool {
	if err == ErrInvalidAction {
		return true
	}
	de, ok := err.(*DeltaError)
	return ok && de.Err == ErrInvalidAction
}
981069
func (cfg *ScopeCfg) IsValid() bool {
	if cfg == nil ||
		strings.TrimSpace(cfg.Client.Provider) == "" ||
		strings.TrimSpace(cfg.Client.Address) == "" {
		return false
	}

	return true
}
1206750
func (v *Validation) Error(message string, args ...interface{}) *ValidationResult {
	result := v.ValidationResult(false).Message(message, args...)
	v.Errors = append(v.Errors, result.Error)
	return result
}
1227564
func (s *stage) checkRelabeling() error {
	if !distro.SelinuxRelabel() || distro.RestoreconCmd() == "" {
		s.Logger.Debug("compiled without relabeling support, skipping")
		return nil
	}

	path, err := s.JoinPath(distro.RestoreconCmd())
	if err != nil {
		return fmt.Errorf("error resolving path for %s: %v", distro.RestoreconCmd(), err)
	}

	_, err = os.Lstat(path)
	if err != nil && os.IsNotExist(err) {
		return fmt.Errorf("targeting root without %s, cannot relabel", distro.RestoreconCmd())
	} else if err != nil {
		return fmt.Errorf("error checking for %s in root: %v", distro.RestoreconCmd(), err)
	}

	// initialize to non-nil (whereas a nil slice means not to append, even
	// though they're functionally equivalent)
	s.toRelabel = []string{}
	return nil
}
793695
func (r Rect) IsValid() bool {
	return r.X.IsEmpty() == r.Y.IsEmpty()
}
1198275
func (s State) CheckValid() error {
	switch s {
	case StateNew, StateStart, StateClose:
		return nil
	default:
		return errors.NewBadParameterError("iteration state", s).Expected(StateNew + "|" + StateStart + "|" + StateClose)
	}
}
741368
func (v *UUIDIsPresent) IsValid(errors *validate.Errors) {
	s := v.Field.String()
	if strings.TrimSpace(s) != "" && v.Field != uuid.Nil {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
1266769
func (f *ScmpFilter) IsValid() bool {
	f.lock.Lock()
	defer f.lock.Unlock()

	return f.valid
}
182811
func (val *Validation) Validate(checkers ...Checker) *Validation {

	for _, checker := range checkers {
		if pass, msg := checker(); !pass {
			if val == nil {
				val = &Validation{}
			}

			val.Errors = append(val.Errors, msg)
		}
	}

	return val
}
74547
func IsInvalid(err error) bool {
	if err != nil {
		switch err.(type) {
		case *Map:
			return err.(*Map).CheckInvalid()
		}
	}
	return err != nil
}
1043783
func (v *StringRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if isNil || IsEmpty(value) {
		return nil
	}

	str, err := EnsureString(value)
	if err != nil {
		return err
	}

	if v.validate(str) {
		return nil
	}
	return errors.New(v.message)
}
463170
func verifyRemovals(deletes []*Validator, vals *ValidatorSet) error {

	for _, valUpdate := range deletes {
		address := valUpdate.Address
		_, val := vals.GetByAddress(address)
		if val == nil {
			return fmt.Errorf("failed to find validator %X to remove", address)
		}
	}
	if len(deletes) > len(vals.Validators) {
		panic("more deletes than validators")
	}
	return nil
}
1011731
func (config Config) Validate() error {
	if config.RevisionUpdater == nil {
		return errors.NotValidf("nil RevisionUpdater")
	}
	if config.Clock == nil {
		return errors.NotValidf("nil Clock")
	}
	if config.Period <= 0 {
		return errors.NotValidf("non-positive Period")
	}
	return nil
}
643909
func checkValidity(cols []string, datas [][]string) bool {
	colLen := len(cols)
	if len(datas) == 0 || colLen == 0 {
		return false
	}

	for _, data := range datas {
		if colLen != len(data) {
			return false
		}
	}

	return true
}
468921
func (c *timeSeriesConfCache) IsValid() bool {
	return c.TimeSeriesConfs != nil && time.Since(c.Generated) < c.TTL
}
117268
func (v *Validation) ValidResult(obj interface{}, args ...string) (ok bool, errs map[string]string) {
	errs = make(map[string]string)
	ok, _ = v.Valid(obj, args...)
	if !ok {
		for _, err := range v.Errors {
			errs[err.Field] = err.Message
		}
	}
	return
}