Lines Matching refs:r
231 for _, r := range neverallowRules(ctx.Config()) {
232 n := r.(*rule)
396 func (r *rule) In(path ...string) Rule {
397 r.paths = append(r.paths, cleanPaths(path)...)
398 return r
401 func (r *rule) NotIn(path ...string) Rule {
402 r.unlessPaths = append(r.unlessPaths, cleanPaths(path)...)
403 return r
406 func (r *rule) InDirectDeps(deps ...string) Rule {
408 r.directDeps[d] = true
410 return r
413 func (r *rule) WithOsClass(osClasses ...OsClass) Rule {
414 r.osClasses = append(r.osClasses, osClasses...)
415 return r
418 func (r *rule) ModuleType(types ...string) Rule {
419 r.moduleTypes = append(r.moduleTypes, types...)
420 return r
423 func (r *rule) NotModuleType(types ...string) Rule {
424 r.unlessModuleTypes = append(r.unlessModuleTypes, types...)
425 return r
428 func (r *rule) With(properties, value string) Rule {
429 return r.WithMatcher(properties, selectMatcher(value))
432 func (r *rule) WithMatcher(properties string, matcher ValueMatcher) Rule {
433 r.props = append(r.props, ruleProperty{
437 return r
440 func (r *rule) Without(properties, value string) Rule {
441 return r.WithoutMatcher(properties, selectMatcher(value))
444 func (r *rule) WithoutMatcher(properties string, matcher ValueMatcher) Rule {
445 r.unlessProps = append(r.unlessProps, ruleProperty{
449 return r
459 func (r *rule) Because(reason string) Rule {
460 r.reason = reason
461 return r
464 func (r *rule) BootclasspathJar() Rule {
465 r.onlyBootclasspathJar = true
466 return r
469 func (r *rule) String() string {
471 for _, v := range r.paths {
474 for _, v := range r.unlessPaths {
477 for _, v := range r.moduleTypes {
480 for _, v := range r.unlessModuleTypes {
483 for _, v := range r.props {
486 for _, v := range r.unlessProps {
489 for k := range r.directDeps {
492 for _, v := range r.osClasses {
495 if r.onlyBootclasspathJar {
498 if len(r.reason) != 0 {
499 s += " which is restricted because " + r.reason
504 func (r *rule) appliesToPath(dir string) bool {
505 includePath := len(r.paths) == 0 || HasAnyPrefix(dir, r.paths)
506 excludePath := HasAnyPrefix(dir, r.unlessPaths)
510 func (r *rule) appliesToDirectDeps(ctx BottomUpMutatorContext) bool {
511 if len(r.directDeps) == 0 {
519 matches = r.directDeps[name]
526 func (r *rule) appliesToBootclasspathJar(ctx BottomUpMutatorContext) bool {
527 if !r.onlyBootclasspathJar {
534 func (r *rule) appliesToOsClass(osClass OsClass) bool {
535 if len(r.osClasses) == 0 {
539 for _, c := range r.osClasses {
548 func (r *rule) appliesToModuleType(moduleType string) bool {
549 …return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unl…
552 func (r *rule) appliesToProperties(properties []interface{}) bool {
553 includeProps := hasAllProperties(properties, r.props)
554 excludeProps := hasAnyProperty(properties, r.unlessProps)
563 r, err := regexp.Compile(re)
567 return ®exMatcher{r}