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
Luacheck .luacheckrc for Factorio 0.15
Luacheck .luacheckrc for Factorio 0.15
Last edited by Nexela on Fri Apr 28, 2017 3:02 am, edited 4 times in total.
Re: Luacheck .luacheckrc for Factorio 0.15
Could you possibly move this to it's own github repository? I have a Makefile build workflow for my mods, and as a git repo, I would be able to easily fetch the latest revision of your luacheck as part of the build process for my mods.
No pressure if you don't want to, but it would make things convenient.
No pressure if you don't want to, but it would make things convenient.
Re: Luacheck .luacheckrc for Factorio 0.15
gists are git repositories that you can fork and clone and use as submodules just like any other repo. Don't let this being a gist stop you from using it!
Re: Luacheck .luacheckrc for Factorio 0.15
I have no problem moving it to github.
I did make a booboo and put the game globals in the all globals spot. (I blame the really long defines table!). Just wish there was an easy way to require files that didn't rely on LUA_PATH
I did make a booboo and put the game globals in the all globals spot. (I blame the really long defines table!). Just wish there was an easy way to require files that didn't rely on LUA_PATH
Re: Luacheck .luacheckrc for Factorio 0.15
TIL. Cool.sparr wrote:gists are git repositories that you can fork and clone and use as submodules just like any other repo. Don't let this being a gist stop you from using it!
Re: Luacheck .luacheckrc for Factorio 0.15
I learned something new too!!!!!
But since working with gists is still a pain I went ahead and moved this to GitHub https://github.com/Nexela/Factorio_luacheckrc as well as fixing some minor issues for .15.3
But since working with gists is still a pain I went ahead and moved this to GitHub https://github.com/Nexela/Factorio_luacheckrc as well as fixing some minor issues for .15.3
Re: Luacheck .luacheckrc for Factorio 0.15
Updated Original Post and added a link to
https://github.com/Nexela/atom-autocomplete-factorio
If you use ATOM drop that package into your home/.atom/packages/
It will enable autocompletes for the factorio API
https://github.com/Nexela/atom-autocomplete-factorio
If you use ATOM drop that package into your home/.atom/packages/
It will enable autocompletes for the factorio API
-
- Inserter
- Posts: 30
- Joined: Sun Apr 30, 2017 7:14 pm
- Contact:
Re: Luacheck .luacheckrc for Factorio 0.15
I only now discovered this thread because the last two days I was busy developing my own autocomplete extension for VS Code LOL
Thanks a lot for the .luacheckrc file, I never wrote lua or factorio mods before so I'm sure it'll be helpful
And here is my VS Code extension in case of curiosity: viewtopic.php?f=34&t=45779
Thanks a lot for the .luacheckrc file, I never wrote lua or factorio mods before so I'm sure it'll be helpful
And here is my VS Code extension in case of curiosity: viewtopic.php?f=34&t=45779
Usually I don't beat babies, but when I do I beat baby biters.