Better types and minor refactor/cleanup #850
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
I want to contribute more to the codebase, but it's a bit daunting without knowing it. Type annotations make it easier and more manageable. But, A lot of the types come from the Github API, so I also added a script to generate them from the Graphlq schema definition (and a the generated file). I didn't know Github also had a REST API before this PR, so those types may need to wait for now :p
Does this pull request fix one issue?
NONE
Describe how you did it
Used the Grahpql specificacion to generate LuaCAT annotations for the Github Grapgql schema. I used those types to better type (and caught a couple of error while doing it) some parts of the codebase
Describe how to verify it
I think I shouldn't have change the behavior of the plugin, but something may have slipped through my refactors. I guess the test should catch it if it happened
Special notes for reviews
Ignore the huge line count, it's mostly because of the huge generate file with the type definitions.
The script on
scripts/generate_gh_types.lua
needs to be run from within Neovim by doing:source
with that file opened. It'll generate the file./lua/octo/_meta/gh.lua
Checklist