github.com/yoheimuta/protolint@v0.49.8-0.20240515023657-4ecaebb7575d/internal/linter/config/ignore.go (about)

     1  package config
     2  
     3  import "github.com/yoheimuta/protolint/internal/stringsutil"
     4  
     5  // Ignore represents files ignoring the specific rule.
     6  type Ignore struct {
     7  	ID    string   `yaml:"id" json:"id" toml:"id"`
     8  	Files []string `yaml:"files" json:"files" toml:"files"`
     9  }
    10  
    11  func (i Ignore) shouldSkipRule(
    12  	ruleID string,
    13  	displayPath string,
    14  ) bool {
    15  	if i.ID != ruleID {
    16  		return false
    17  	}
    18  	return stringsutil.ContainsCrossPlatformPathInSlice(displayPath, i.Files)
    19  }