GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

lib/app.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1.33

Size

Lines of Code 78
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 0
c 3
b 0
f 0
nc 1
dl 0
loc 78
rs 10
wmc 8
mnd 1
bc 8
fnc 6
bpm 1.3333
cpm 1.3333
noi 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A App.log 0 5 2
A App.run 0 9 1
A App.createMowers 0 8 2
A app.js ➔ App 0 7 1
1
'use strict';
2
3
var os = require('os'),
4
    EOL = os.EOL,
5
    Config = require('./config'),
6
    Position = require('./position'),
7
    Grid = require('./grid'),
8
    Mower = require('./mower');
9
10
// Expose `App`.
11
12
module.exports = App;
13
14
15
/**
16
 * Set up App with `options`
17
 * which is responsible for multiple-unit mower's remote control
18
 *
19
 * Options:
20
 *
21
 *   - `configFile` config file path
22
 *
23
 * @param {Object} options
24
 * @api public
25
 */
26
27
function App(options) {
28
    this.options = options || {};
29
    this.config = new Config(this.options.configFile);
30
    this.logEnabled = this.options.debug || false;
31
    this.grid = new Grid(this.config.topRightPos);
32
    this.mowers = this.createMowers(this.config.mowers);
33
}
34
35
/**
36
 * Start mower's movement.
37
 *
38
 * @api protected
39
 */
40
41
App.prototype.run = function() {
42
    var self = this;
43
    this.mowers.forEach(function(mower) {
44
        mower.start().then(function(mower) {
45
            self.log('Mower '+mower.id+' stopped at position: x:' +
46
                mower.position.x+' y:'+mower.position.y+' cardinal: '+mower.position.c+EOL)
47
        });
48
    });
49
};
50
51
/**
52
 * Create mowers
53
 *
54
 * @param {Array} mowersConf
55
 * @api protected
56
 */
57
58
App.prototype.createMowers = function(mowersConf) {
59
    var mowers = [];
60
    for(var i=0; i<mowersConf.length; i++) {
61
        var position = new Position(mowersConf[i].pos, mowersConf[i].cardinal);
62
        mowers.push(new Mower(i, this.grid, position, mowersConf[i].instructions));
63
    }
64
    return mowers;
65
};
66
67
/**
68
 * Stdout filtered by log option
69
 *
70
 * @param {String} message
71
 * @api protected
72
 */
73
74
App.prototype.log = function(message) {
75
    if(this.logEnabled) {
76
        process.stdout.write(message);
77
    }
78
};
79