Luacheck .luacheckrc for Factorio 0.15
Posted: Wed Apr 26, 2017 11:35 pm
For anyone that uses luacheck for linting their code I have created a fairly strict .luacheckrc that can be found at
https://github.com/Nexela/Factorio-luacheckrc
[Updated for 15.3]
Moved to GitHub
Fixed Defines
Fixed some globals in wrong environment
I Will keep that updated as I make more and more changes and fixes.
Current "features"
Uses separate linting environments depending on the file.
Anything in data*.lua, settings*.lua prototypes/*.lua will show warnings if trying to access game script functions not available
Other lua files will show warnings when trying to use globals only available in the data stage.
All defines are listed. if you make a typo when accessing a defines you will be warned. defines.on_event.fake_event will show a warning.
The top level game global and associated methods are listed as well. game.not_available() will throw a warning.
luacheck now includes a windows binary for easy installation https://github.com/mpeterv/luacheck/releases
After installing luacheck save the .luacheckrc file to your source directory (or any directory before it).
Don't forgot to install a linter and linter luacheck package in your editor of choice.
Additional a working fork of the atom-autocomplete-factorio package can be found here https://github.com/Nexela/atom-autocomplete-factorio
It currently supports factorio .15.3
If you use ATOM drop that package into your home/.atom/packages/
It will enable autocompletes for the factorio API
[related]viewtopic.php?f=34&t=29919&p=206389&hil ... ck#p206389
https://github.com/Nexela/Factorio-luacheckrc
[Updated for 15.3]
Moved to GitHub
Fixed Defines
Fixed some globals in wrong environment
I Will keep that updated as I make more and more changes and fixes.
Current "features"
Uses separate linting environments depending on the file.
Anything in data*.lua, settings*.lua prototypes/*.lua will show warnings if trying to access game script functions not available
Other lua files will show warnings when trying to use globals only available in the data stage.
All defines are listed. if you make a typo when accessing a defines you will be warned. defines.on_event.fake_event will show a warning.
The top level game global and associated methods are listed as well. game.not_available() will throw a warning.
luacheck now includes a windows binary for easy installation https://github.com/mpeterv/luacheck/releases
After installing luacheck save the .luacheckrc file to your source directory (or any directory before it).
Don't forgot to install a linter and linter luacheck package in your editor of choice.
Additional a working fork of the atom-autocomplete-factorio package can be found here https://github.com/Nexela/atom-autocomplete-factorio
It currently supports factorio .15.3
If you use ATOM drop that package into your home/.atom/packages/
It will enable autocompletes for the factorio API
[related]viewtopic.php?f=34&t=29919&p=206389&hil ... ck#p206389