Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter CI check #260

Open
Nick-Mazuk opened this issue Jul 17, 2022 · 0 comments
Open

Linter CI check #260

Nick-Mazuk opened this issue Jul 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Nick-Mazuk
Copy link
Member

This is inspired by #255.

In short, we should add a linter to ensure added Lua code is valid. I see this as a two phase project:

  1. We use an existing tool that lints Lua code, ensuring things like imported files exist, only valid variables / functions are referenced, functions are called with the correct number of arguments, etc.
  2. We create a custom linter that also does type checking. We can use the documentation comments to deduce the types of function arguments / return values, and something like the Hindly-Milner type system to infer the types of all variables. We can then ensure that all functions are called with the correct objects, that variables are always reassigned to the same type, and only valid methods/properties are called from Finale objects. There is not an existing solution for this as we'd need to define every single object inside the linter (e.g., finale.FCString())

Phase 1 seems quite doable and would catch basic mistakes that would be detrimental to our code. While it wouldn't be too useful when developing scripts (because we are probably manually testing our scripts to begin with), it could catch errors when refactoring our shared library.

Phase 2 would yield massive benefits in stability for the ecosystem as a whole, especially since it's unlikely we'll be able to add tests as described in #255. However, this would take a lot of effort on our end. Perhaps not worth it right now (though I'm working on a similar project for my personal use so I'd be able to share a lot of the same learnings).

cc @rpatters1

@Nick-Mazuk Nick-Mazuk added the enhancement New feature or request label Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant