Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

.luacheckrc is no longer read #32

Closed
Nexela opened this issue May 3, 2017 · 6 comments
Closed

.luacheckrc is no longer read #32

Nexela opened this issue May 3, 2017 · 6 comments
Labels

Comments

@Nexela
Copy link

Nexela commented May 3, 2017

Latest update ignores .luacheckrc

Possibly due to the new "standards" settings

@Arcanemagus
Copy link
Member

Hmmm, this sounds like a bug in luacheck itself. Does it work on its own in the CLI if you specify luacheck --std _G foo.lua?

@Nexela
Copy link
Author

Nexela commented May 3, 2017

Using https://github.com/Nexela/Factorio-luacheckrc
on this file
https://github.com/Nexela/PickerExtended/blob/master/control.lua

running luacheck control.lua from the command line shows 0 warnings
running luacheck --std _G control.lua shows 25 warnings
using linter-luacheck 1.2.0 shows 0 warnings
using linter-luacheck 2.0.0 shows 25 warnings

@pablomayobre
Copy link
Contributor

pablomayobre commented May 4, 2017

First, this is a bug in Luacheck itself, .luacheckrc should always override the CLI options or at least add to them.

There is a way to fix this, we can make the default value equal to the empty array, which means that --std wouldn't be passed as a command by default. This means, for example, that if you set the Standards config to busted it would only allow you to use globals defined by busted, if you wanted to add this to the default standard you would need to write _G, busted... is this better?

Alternatively this option could be additive as proposed by @Arcanemagus which would mean that busted would be passed as --std +busted which means default + busted, the issue with this is that if you want for example only values in the luajit standard but you are running Luacheck in Lua 5.3, setting the config to luajit would actually mean default + luajit or lua53c + luajit which wouldn't be what you want.

So both has it's pro and cons, a third option would be to be able to Enable/Disable this configuration... Which I don't really like, I personally favour the first option.

Anyway I reported it over at Luacheck

UGLY FIX set your Standards configuration to a (space) character instead of _G (If you tried to leave it blank Atom would default to _G but with a space Atom won't try to change it back), with this config the --std argument won't be passed to the command line, so it will use the .luacheckrc std option instead.

@Arcanemagus
Copy link
Member

How about we change the default to nothing, and leave it up to the user to handle adding _G if they desire?

That works around this bug in luacheck and doesn't put this in the situation of always appending to the default.

@pablomayobre
Copy link
Contributor

pablomayobre commented May 4, 2017

Yeah first option then! I consider this issue a breaking change since it breaks the use of the .luacheckrc file, so I pushed a patch already with the fix.

I may add a tip later to the README saying that you can use _G, busted if someone wants additive behaviour

@pablomayobre
Copy link
Contributor

Yes this should fix the issue, it looks like this is intended behaviour in Luacheck so the way we dealt with it is the best way.

In a near feature Luacheck will implement Global Config (mpeterv/luacheck#102) and there will be no need for this package to provide any configuration at all except for the Executable Path

@Arcanemagus Arcanemagus added the bug label May 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants