• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

riot / cli / 78

pending completion
78

push

travis-ci

GianlucaGuarini
updated: force mocha to exit

134 of 201 branches covered (66.67%)

207 of 268 relevant lines covered (77.24%)

10.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

12.5
/lib/tasks/Check.js
1
'use strict'
2

3
const Task = require('../Task'),
1✔
4
  analyzer = require('../analyzer'),
5
  helpers = require('../helpers'),
6
  chalk = require('chalk'),
7
  log = helpers.log,
8
  find = helpers.find.bind(helpers),
9
  toRelative = helpers.toRelative
10

11

12
class Check extends Task {
13
  run(opt) {
14
    // check input files
15
    var from = opt.flow[0] === 'f' ? [opt.from] : find(this.extRegex, opt.from),
×
16
      // map the results of the tests
17
      results = from
18
        .map(file => {
19
          // get the content of the tag file analysing it
20
          var results = analyzer(helpers.readFile(file))
×
21
          return {
×
22
            file: toRelative(file),
23
            errors: results.filter(result => result.error)
×
24
          }
25
        })
26
        // remove the entries without errors
27
        .filter(results => results.errors.length)
×
28

29
    // errors found
30
    if (results.length) {
×
31
      log(chalk.white.bgRed('Riot Tag Syntax Error'))
×
32
      // log the errors
33
      results.forEach(check => {
×
34
        check.errors.forEach(result => {
×
35
          log(chalk.yellow(`${result.line} | `) + result.source)
×
36
          log(chalk.red(`^^^  ${result.error}`))
×
37
        })
38
        log(chalk.yellow(`Total error: ${check.errors.length} in "${check.file}"`))
×
39
      })
40
    } else
41
      // congrats no errors found!
42
      log(chalk.green('No syntax error. Ready to compile :)'))
×
43

44
    return results
×
45
  }
46
}
47

48
module.exports = Check
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2024 Coveralls, Inc