Skip to content

Commit

Permalink
Add poetry and pre-comit. Also fix related linter issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmlkang committed Aug 3, 2022
1 parent e4e8f82 commit 517d3da
Show file tree
Hide file tree
Showing 23 changed files with 1,049 additions and 35 deletions.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict

- repo: local
hooks:
- id: tests
name: Tests
entry: 'npm test --prefix ait/gui/static'
language: system
stages: [push]
pass_filenames: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "node"

before_install:
- cd ait/gui/static

Expand Down
16 changes: 8 additions & 8 deletions ait/gui/openmct_adapter/ait_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ function AITIntegration() {
namespace: 'taxonomy',
key: 'spacecraft'
});

openmct.objects.addProvider('taxonomy', objectProvider);

openmct.composition.addProvider(compositionProvider);

openmct.types.addType('telemetry', {
name: 'Telemetry Point',
description: 'Spacecraft Telemetry point',
Expand All @@ -135,14 +135,14 @@ function AITHistoricalTelemetryPlugin() {
request: function (domainObject, options) {
let url = '/history/' + domainObject.identifier.key +
'?start=' + options.start + '&end=' + options.end;

return http.get(url)
.then(function (resp) {
return resp.data
});
}
};

openmct.telemetry.addProvider(provider);
}
};
Expand All @@ -152,7 +152,7 @@ function AITRealtimeTelemetryPlugin() {
let socket = new WebSocket(
'ws://' + AIT_HOST + ':' + AIT_PORT + '/tlm/realtime/openmct');
let listener = {};

socket.onmessage = function (event) {
let now = Date.now()

Expand All @@ -170,7 +170,7 @@ function AITRealtimeTelemetryPlugin() {
}
}
};

let provider = {
supportsSubscribe: function (domainObject) {
return domainObject.type === 'telemetry';
Expand All @@ -182,7 +182,7 @@ function AITRealtimeTelemetryPlugin() {
};
}
};

openmct.telemetry.addProvider(provider);
}
};
2 changes: 1 addition & 1 deletion ait/gui/static/build/0292d248d009b01cf97cefdfa39c3cf3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ait/gui/static/css/ait/gui/Playback.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ ait-playback .controls {

ait-playback .col-xs-3 {
padding-left: 0;
}
}
1 change: 0 additions & 1 deletion ait/gui/static/css/ait/gui/TabSet.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ ait-tabset ul.nav-stacked li.drag-over-after {
padding-right: 0;
padding-bottom: 4em;
}

2 changes: 1 addition & 1 deletion ait/gui/static/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ait/gui/static/fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ait/gui/static/js/ait/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EventBus
const listeners = this._listeners[event]
const index = listeners && listeners.indexOf(fn)
const found = index !== undefined && index !== -1

if (found) {
listeners.splice(index, 1)
}
Expand Down
4 changes: 2 additions & 2 deletions ait/gui/static/js/ait/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function time (obj, { h24 = true, gps = true, utc = false } = {}) {
} else {
hh = time.getHours()
mm = time.getMinutes()
ss = time.getSeconds()
ss = time.getSeconds()
}

if (!h24 && hh > 12) {
Expand All @@ -127,7 +127,7 @@ function tz (obj, { utc = false, gps = true, local = false } = {}) {
if (gps) {
return 'GPS'
} else if (utc) {
return 'UTC'
return 'UTC'
} else if (local) {
return 'Local Time'
} else {
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/js/ait/gui/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as format from 'ait/format'
* AIT Clock UI Widget
*
* The AIT Clock UI Widget displays a clock with date and time that
* updates every second. The display is configurable at initialization
* updates every second. The display is configurable at initialization
* time or by clicking on specific parts of the time / date display.
*
* Configurable / Toggleable options include:
Expand Down
4 changes: 2 additions & 2 deletions ait/gui/static/js/ait/gui/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const CommandInput = {
if (e.keyCode == 17) {
this._cntrl_toggled = true
}

// Cancel submission if
// - Enter was pressed without pressing Ctrl
// - Enter + Ctrl was pressed but the command isn't valid
Expand Down Expand Up @@ -485,7 +485,7 @@ const CommandConfigure = {
_cmding_disabled: false,
_cmd_valid: false,
_validating: false,

// We need to keep track of the selected command state for initial command
// validation so we can handle commands that are always valid (commands
// with no arguments or only enumerated values).
Expand Down
8 changes: 4 additions & 4 deletions ait/gui/static/js/ait/gui/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const Field =
if ('upper' in this._limits && 'error' in this._limits.upper) {
isError = value > this._limits.upper.error
}

if ('lower' in this._limits && 'error' in this._limits.lower) {
isError = value < this._limits.lower.error || isError
}
Expand All @@ -159,7 +159,7 @@ const Field =
} else {
if ('upper' in this._limits && 'warn' in this._limits.upper) {
isWarning = value > this._limits.upper.warn
}
}

if ('lower' in this._limits && 'warn' in this._limits.lower) {
isWarning = value < this._limits.lower.warn || isWarning
Expand Down Expand Up @@ -292,7 +292,7 @@ const Field =
},

onbeforeupdate (vnode, old) {
return this.hasChanged()
return this.hasChanged()
},

view (vnode) {
Expand Down Expand Up @@ -365,7 +365,7 @@ const Field =
dname = vnode.attrs.display_name + ': '
}

return m('ait-field', vnode.attrs, [m('name', dname),
return m('ait-field', vnode.attrs, [m('name', dname),
m('value', value)])
}
}
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/js/ait/gui/Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ const Scripts = {
ait.events.on('script:resume', (e) => {
ScriptsState.execState = 'running'
})

ait.events.on('script:loaded', (e) => {
ScriptsState.execState = 'stopped'
this._script_load_toggle = !this._script_load_toggle
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/js/ait/gui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function createMithrilNode (elem) {
return node
}


function makeMithrilNode(e) {
if (e === undefined || e.tag === undefined) {
return e
Expand Down
8 changes: 4 additions & 4 deletions ait/gui/static/js/ait/packets.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PacketBuffer
* @return the underlying circular _buffer index for n.
*/
_index (n) {

return (this._start + this._length + n) % this._buffer.length
}

Expand Down Expand Up @@ -84,7 +84,7 @@ class PacketBuffer
* Inserts a packet into this PacketBuffer, removing the oldest
* packet, if the buffer is at capacity.
*/
insert (packet) {
insert (packet) {
if ((this._length + 1) > this._buffer.length) {
this.remove()
}
Expand Down Expand Up @@ -123,7 +123,7 @@ class PacketBuffers
{
create (name, capacity = 600) {
let created = false

if (this[name] === undefined) {
this[name] = new PacketBuffer(capacity)
created = true
Expand All @@ -132,7 +132,7 @@ class PacketBuffers
return created
}


insert (name, packet) {
if (this[name] === undefined) {
this.create(name)
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/js/ait/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function DOY (year, month, day) {

/**
* @returns true if year is a leap year, false otherwise.
*/
*/
function isLeap (year) {
return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)
}
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Each class sets a background color for a message of a given
* severity when it is displayed in the ait-messages component.
*
* E.g.,
* E.g.,
* "ait-messages .entry--critical" sets the background color
* for a "critical" message.
*
Expand Down
1 change: 0 additions & 1 deletion ait/gui/static/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--compilers js:babel-core/register
-r jsdom-global/register

1 change: 0 additions & 1 deletion doc/source/ait_gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ You can send example telemetry data to the GUI for testing using **ait_tlm_send.
$ ait-tlm-send /path/to/sometestdata.pcap
You will need to ensure that the **tlm.yaml** used when generating the example PCAP data matches the **tlm.yaml** you're using when running **ait_tlm_send**, otherwise you will end up with data that looks odd in the UI.

1 change: 0 additions & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

Loading

0 comments on commit 517d3da

Please sign in to comment.