`incorrect_standard_library_use` ignores overrides in standard libraries
tomodachi94 opened this issue · comments
The standard library I'm working with has a custom global/API named fs
. I defined it in my standard lib (under globals
), and I get this error when I run the linter.
Is this intended behavior or is this a bug?
A workaround is disabling the incorrect_standard_library_use
linter in selene.toml
.
Can you show your standard library format, your code, and your selene.toml?
@Kampfkarren:
selene.toml
:
std = "cc-tweaked"
[lints]
# incorrect_standard_library_use = "allow" # Workaround for https://github.com/Kampfkarren/selene/issues/467
cc-tweaked.yaml
:
---
base: lua52
globals:
package.cpath:
removed: true
collectgarbage:
removed: true
_HOST:
property: read-only
colors:
property: read-only
colours:
property: read-only
commands:
property: read-only
disk:
property: read-only
fs:
property: read-only
gps:
property: read-only
help:
property: read-only
http:
property: read-only
io:
property: read-only
keys:
property: read-only
multishell:
property: read-only
os:
property: read-only
paintutils:
property: read-only
parallel:
property: read-only
peripheral:
property: read-only
pocket:
property: read-only
rednet:
property: read-only
redstone:
property: read-only
settings:
property: read-only
shell:
property: read-only
term:
property: read-only
textutils:
property: read-only
turtle:
property: read-only
vector:
property: read-only
window:
property: read-only
Code (valid on the platform I'm using):
-- Reads a file and prints it to the screen
local file = fs.open("/testfile.txt") -- Selene complains about this line
print(file.readAll())
I'll play with this, thanks
Also, quick question @Kampfkarren, does Selene have LSP functionality? If so, is it documented somewhere? I'd love to be able to get warnings about my code inside Neovim.
There's no LSP but there definitely are Neovim configs out there, a ton of Neovim people use selene
Oh, this isn't a bug, your standard library is just wrong
property: read-only
means that it doesn't have any properties of its own: https://kampfkarren.github.io/selene/usage/std.html#properties
If you add something like:
fs.open:
args:
- type: string
...then it should work.
See: https://kampfkarren.github.io/selene/usage/std.html#functions