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.

Issues (890)

src/system-plugins/rov-beacon/index.js (20 issues)

1
'use strict';
0 ignored issues
show
Use the function form of "use strict".
Loading history...
2
const beaconRate = 5000;
0 ignored issues
show
Backwards Compatibility introduced by
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
3
const ignorePressureChangeThreshold = 100000;
0 ignored issues
show
Backwards Compatibility introduced by
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
4
const RESIN_APP_RELEASE = process.env.RESIN_APP_RELEASE;
0 ignored issues
show
Backwards Compatibility introduced by
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
process does not seem to be defined.
Loading history...
5
class RovBeacon{
0 ignored issues
show
Backwards Compatibility introduced by
'class' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
6
    constructor(name,deps){
7
     this.state={
8
         name: require('os').hostname(),
0 ignored issues
show
require does not seem to be defined.
Loading history...
9
         //model:'trident',  //TODO: Add model detection
10
         battery:.7,
0 ignored issues
show
Coding Style Comprehensibility introduced by
A leading decimal point can be confused with a dot: '.7'.
Loading history...
11
         imageVersion:RESIN_APP_RELEASE
12
     };
13
     this.beacon = null;
14
     this.bus = deps.globalEventLoop;
15
16
     this._lastIntPressureReading = {time:0,p:0,t:0};
17
    }
18
19
    start() {
20
     this.beacon = require('./beacon.js')({beaconRate});
0 ignored issues
show
Backwards Compatibility introduced by
'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
require does not seem to be defined.
Loading history...
21
     this.beacon.broadcast(this._genBeaconMessage.bind(this));
22
     this._listenForStateChanges();
23
    }
24
25
    stop(){
26
     this.beacon.stop();
27
     this._stopListenForStateChanges()
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
28
    }
29
30
    _genBeaconMessage(){
31
        this.state.exp=beaconRate*2; //Set the expeiration for this to 2X the broadcast rate.
32
        return this.state;
33
    }
34
35
    _listenForStateChanges(){
36
      this.bus.on('mcu.status',this._processMCUStatus.bind(this))
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
37
    }
38
39
    _stopListenForStateChanges(){
40
      this.bus.off('mcu.status',this._processMCUStatus.bind(this))
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
41
    }
42
43
    _computerPressureTrend(currentpressure,currenttemp){
44
        //TODO: Do we need to enhance for temperature compensation?
45
        if (this._lastIntPressureReading.p> (currentpressure+ignorePressureChangeThreshold)) {
46
            return this._lastIntPressureReading.p-currentpressure;
47
        }
48
        if (this._lastIntPressureReading.p< ( currentpressure-ignorePressureChangeThreshold)){
49
            return this._lastIntPressureReading.p-currentpressure;
50
        }
51
        return 0
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
52
    }
53
54
    _processMCUStatus(status){
55
        for (var data in status) {
56
            switch (data) {
57
                case 'baro_p' : 
58
                    //TODO: Confirm the value units of baro_p
59
                    //https://gitlab.com/openrov/RIOT/blob/openrov/apps/trident/CMPL3115A2.cpp#L98
60
                    this.state.intPressure_mb=status["baro_p"];
0 ignored issues
show
['baro_p'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
61
                    //TODO: Does this need to be smoothed over time?
62
                    this.state.intPressureRate=this._computerPressureTrend(this.state.intPressure_mb,status['baro_t']);
0 ignored issues
show
['baro_t'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
63
                    this._lastIntPressureReading = {time: Date.now(), p:this.state.intPressure_mb, t:status['baro_t']};
0 ignored issues
show
['baro_t'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
64
                break;
65
                case 'vout' :
66
                  this.state.battery = status['vout'];
0 ignored issues
show
['vout'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
67
                break;
68
                case 'batt_v': //Ma
69
                 this.state.battery = status['batt_v'] / 1000.0;
0 ignored issues
show
['batt_v'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
70
                break;                
71
            }
72
        }
73
    }
74
75
}
76
77
module.exports = function (name, deps) {
0 ignored issues
show
module does not seem to be defined.
Loading history...
78
  return new RovBeacon(name, deps);
79
};