MCPcopy Create free account
hub / github.com/vale-cli/vale / applyInlinePatterns

Function applyInlinePatterns

internal/lint/html.go:91–123  ·  view source on GitHub ↗
(c *core.Config, exts extensionConfig, content string)

Source from the content-addressed store, hash-verified

89}
90
91func applyInlinePatterns(c *core.Config, exts extensionConfig, content string) (string, error) {
92 inline, ok := inlineDelimiters[exts.Normed]
93 if !ok {
94 return content, fmt.Errorf("ignore patterns are not supported in '%s' files", exts.Normed)
95 }
96
97 for syntax, regexes := range c.TokenIgnores {
98 sec, err := glob.Compile(syntax)
99 if err != nil {
100 return content, err
101 } else if sec.Match(exts.Normed) || sec.Match(exts.Real) {
102 for _, r := range regexes {
103 pat, errc := regexp2.CompileStd(r)
104 if errc != nil {
105 return content, core.NewE201FromTarget(
106 errc.Error(),
107 r,
108 c.Flags.Path,
109 )
110 }
111 content, err = pat.Replace(content, inline, 0, -1)
112 if err != nil {
113 return content, core.NewE201FromTarget(
114 err.Error(),
115 r,
116 c.Flags.Path,
117 )
118 }
119 }
120 }
121 }
122 return content, nil
123}
124
125// applyCommentPatterns replaces any custom comment delimiters with HTML comment
126// tags based on the user configuration. This makes it possible to apply

Callers 1

applyPatternsFunction · 0.85

Calls 3

CompileFunction · 0.92
NewE201FromTargetFunction · 0.92
MatchMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…