mpeterv / luacheck

A tool for linting and static analysis of Lua code.
MIT License
1.92k stars 322 forks source link

[wip] Add initial std definitions for redis an vlc #95

Closed marsam closed 6 years ago

marsam commented 7 years ago

Hi:

Thanks for your work in luacheck.

I tend to write lua and vlc scripts, and I think could be a nice addition to luacheck to add an std for both.

If you are interested in this change, I can complete the rest of globals, else feel free to close this pull request.

Thanks in advance.

mpeterv commented 7 years ago

Hi,

Yes, I think this would be a good addition, thanks!

mpeterv commented 7 years ago

@marsam there is now a new format for describing stds. It allows listing all allowed fields within globals. But it's good enough to list just the globals and allow all fields within them.

marsam commented 7 years ago

@mpeterv I see, looks good!. I'll work in this pull request this weekend

pablomayobre commented 7 years ago

Let me ask here. If I wanted to make a standard for the LÖVE game framework, would there be a chance of it being merged into Luacheck?

If so, should I declare all the functions that are available in each module? Or is it prefered to define love as a read_only global variable with other_fields and set the callbacks with read_only = false?

Wouldn't it be great to have a standards table where people can submit standards? or maybe even a repository that acts as a submodule of luacheck

mpeterv commented 7 years ago

@Positive07 if the interface of love2d is stable enough I will merge a PR adding a standard. But if functions inside modules are often added then it's probably better to have the standard available separately in some module. Then it could be imported with, say, stds.love = require "luacheck.standards.love" in .luacheckrc. It could be made more convenient if luacheck looked up used standards in luacheck.standards.* modules automatically.

pablomayobre commented 7 years ago

Well it would change every version so I guess that it's pretty stable, versions are released with months of separation and older versions are deprecated instantly so we would only need to support the latest.

The problem is that the API is broad and can make the standard file really long so I would prefer to split it out. Would that be fine?

I can also make a script that automatically updates this file by using the love-api repo which is updated immediately every time a new release is available. Then I would submit PRs when an update is needed. Would that be good enough to keep it stable?

mpeterv commented 7 years ago

@Positive07 that's good, and of course the definition can be put into a separate luacheck module (e.g. luacheck.love_std) so that the main std file is not too long and changes are localized.

pablomayobre commented 7 years ago

Alright I made this I'll make a PR later, I'll still have to merge this table with LuaJIT to get the real standard or see how busted is handled

I think that going the busted way is the best choice since LÖVE can be built against any version of Lua

mpeterv commented 6 years ago

Closing due to inactivity, feel free to reopen if necessary.