Robot Not a Dev? Pre-order Now
Not a Dev?

Misty Community Forum

Static analysis tools for Misty skills?

#1

Are there any tools for static analysis of Misty skills?

For example, I imagine a program that decides whether a given zip file satisfies basic requirements to be deployed on a Misty robot, including whether the Meta and Code files are present and consistent with each other. This simple tool might also search for likely errors, e.g., misty.ChangLED(0, 255, 0); instead of misty.ChangeLED(0, 255, 0); (in general, methods that do not exist in the misty object as presented at Misty Docs | On-Robot JavaScript API Tutorials)

1 Like
#2

:eyes: Looking into this, @slivingston

#3

@slivingston so you’re asking for a linter, correct?

#4

Hi @slivingston, uploading consistent files is addressed with the latest develop changes soon to be released (you must have a js and json file and they are both syntax checked at upload).
Currently, the second item can’t be checked at upload, right now it is treated as a runtime error. If you are using the skill runner and listening to skill data events, it will indicate that misty.ChangLED(0, 255, 0); is an invalid method when they attempt to call it at runtime.

1 Like
#5

(I tried to reply via email but apparently it did not complete, so copying here:)

Yes, a linter.

Also I am interested in more sophisticated tools besides linters. Anything that gives feedback about code before running on a Misty robot.

1 Like
#6

I need to be able to check the code before it is uploaded to the robot. In particular, I need these processes to be decoupled: checking and uploading. “decoupled”, i.e., I can check the code without uploading it.

#7

Scott - can you go a little deeper into your use case that requires checking the code prior to upload?

#8

e.g., CI (continuous integration) testing

After every changeset, I want to run various tests against the code without running it on a robot. One example of a pure software CI provider tightly integrated with GitHub is Travis CI.

#9

Sure, thanks Scott. I’ve used Travis before. Good example.

#12

I began work on a static analysis tool, named mistygrind:

The first release (version 0.1.0) has trivial but useful checks for skills, including whether the GUID is well-formed, the file names are consistent, and JavaScript syntax is valid.

4 Likes
#13

Nice! Thanks @slivingston, looks like you’re using the same linter that visual studio code uses (ESLint), didn’t realize they had their code available. Great stuff!

#14

I created an ESLint rule that compares calls to the misty object against a list of acceptable properties. The list is not exhaustive because I know that the Misty skills API is going to change soon.

1 Like
#15

Nice! Thanks Scott!