Lines Matching refs:r

255 	for _, r := range neverallowRules(ctx.Config()) {
256 n := r.(*rule)
400 func (r *rule) In(path ...string) Rule {
401 r.paths = append(r.paths, cleanPaths(path)...)
402 return r
405 func (r *rule) NotIn(path ...string) Rule {
406 r.unlessPaths = append(r.unlessPaths, cleanPaths(path)...)
407 return r
410 func (r *rule) InDirectDeps(deps ...string) Rule {
412 r.directDeps[d] = true
414 return r
417 func (r *rule) WithOsClass(osClasses ...OsClass) Rule {
418 r.osClasses = append(r.osClasses, osClasses...)
419 return r
422 func (r *rule) ModuleType(types ...string) Rule {
423 r.moduleTypes = append(r.moduleTypes, types...)
424 return r
427 func (r *rule) NotModuleType(types ...string) Rule {
428 r.unlessModuleTypes = append(r.unlessModuleTypes, types...)
429 return r
432 func (r *rule) With(properties, value string) Rule {
433 return r.WithMatcher(properties, selectMatcher(value))
436 func (r *rule) WithMatcher(properties string, matcher ValueMatcher) Rule {
437 r.props = append(r.props, ruleProperty{
441 return r
444 func (r *rule) Without(properties, value string) Rule {
445 return r.WithoutMatcher(properties, selectMatcher(value))
448 func (r *rule) WithoutMatcher(properties string, matcher ValueMatcher) Rule {
449 r.unlessProps = append(r.unlessProps, ruleProperty{
453 return r
463 func (r *rule) Because(reason string) Rule {
464 r.reason = reason
465 return r
468 func (r *rule) String() string {
470 for _, v := range r.paths {
473 for _, v := range r.unlessPaths {
476 for _, v := range r.moduleTypes {
479 for _, v := range r.unlessModuleTypes {
482 for _, v := range r.props {
485 for _, v := range r.unlessProps {
488 for k := range r.directDeps {
491 for _, v := range r.osClasses {
494 if len(r.reason) != 0 {
495 s += " which is restricted because " + r.reason
500 func (r *rule) appliesToPath(dir string) bool {
501 includePath := len(r.paths) == 0 || HasAnyPrefix(dir, r.paths)
502 excludePath := HasAnyPrefix(dir, r.unlessPaths)
506 func (r *rule) appliesToDirectDeps(ctx BottomUpMutatorContext) bool {
507 if len(r.directDeps) == 0 {
515 matches = r.directDeps[name]
522 func (r *rule) appliesToOsClass(osClass OsClass) bool {
523 if len(r.osClasses) == 0 {
527 for _, c := range r.osClasses {
536 func (r *rule) appliesToModuleType(moduleType string) bool {
537 …return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unl…
540 func (r *rule) appliesToProperties(properties []interface{}) bool {
541 includeProps := hasAllProperties(properties, r.props)
542 excludeProps := hasAnyProperty(properties, r.unlessProps)
551 r, err := regexp.Compile(re)
555 return &regexMatcher{r}