Skip to content

Instantly share code, notes, and snippets.

@pfitzseb
Created Jan 31, 2022
Embed
What would you like to do?
Lint a Julia project
using LanguageServer, StaticLint, SymbolServer
path = abspath(ARGS[1])
root_file = if length(ARGS) > 1
abspath(ARGS[2])
else
joinpath(path, "src", string(basename(path), ".jl"))
end
s = LanguageServerInstance(Pipe(), stdout, path)
_, symbols = SymbolServer.getstore(s.symbol_server, path)
s.global_env.symbols = symbols
s.global_env.extended_methods = SymbolServer.collect_extended_methods(s.global_env.symbols)
s.global_env.project_deps = collect(keys(s.global_env.symbols))
f = StaticLint.loadfile(s, root_file)
StaticLint.semantic_pass(LanguageServer.getroot(f))
StaticLint.check_all(LanguageServer.getcst(f), s.lint_options, LanguageServer.getenv(f, s))
empty!(f.diagnostics)
LanguageServer.mark_errors(f, f.diagnostics)
foreach(println, f.diagnostics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment