MCPcopy
hub / github.com/htmlhint/HTMLHint / hintTargets

Function hintTargets

src/cli/htmlhint.ts:161–216  ·  view source on GitHub ↗
(
  arrTargets: string[],
  options: {
    formatter: Formatter
    ruleset?: Ruleset
    rulesdir?: string
    ignore?: string
  }
)

Source from the content-addressed store, hash-verified

159}
160
161function hintTargets(
162 arrTargets: string[],
163 options: {
164 formatter: Formatter
165 ruleset?: Ruleset
166 rulesdir?: string
167 ignore?: string
168 }
169) {
170 let arrAllMessages: Array<{
171 file: string
172 messages: Hint[]
173 time: number
174 }> = []
175 let allFileCount = 0
176 let allHintFileCount = 0
177 let allHintCount = 0
178 const startTime = new Date().getTime()
179
180 const formatter = options.formatter
181
182 // load custom rules
183 const rulesdir = options.rulesdir
184 if (rulesdir) {
185 loadCustomRules(rulesdir)
186 }
187
188 // start hint
189 formatter.emit('start')
190
191 const arrTasks: Array<(next: () => void) => void> = []
192 arrTargets.forEach((target) => {
193 arrTasks.push((next) => {
194 hintAllFiles(target, options, (result) => {
195 allFileCount += result.targetFileCount
196 allHintFileCount += result.targetHintFileCount
197 allHintCount += result.targetHintCount
198 arrAllMessages = arrAllMessages.concat(result.arrTargetMessages)
199 next()
200 })
201 })
202 })
203
204 asyncSeries(arrTasks, () => {
205 // end hint
206 const spendTime = new Date().getTime() - startTime
207 formatter.emit('end', {
208 arrAllMessages: arrAllMessages,
209 allFileCount: allFileCount,
210 allHintFileCount: allHintFileCount,
211 allHintCount: allHintCount,
212 time: spendTime,
213 })
214 process.exit(!cliOptions.warn && allHintCount > 0 ? 1 : 0)
215 })
216}
217
218// load custom rules

Callers 1

htmlhint.tsFile · 0.85

Calls 3

loadCustomRulesFunction · 0.85
hintAllFilesFunction · 0.85
emitMethod · 0.80

Tested by

no test coverage detected