Last active
April 25, 2023 09:24
-
-
Save pfitzseb/22493b0214276d3b65833232aa94bf11 to your computer and use it in GitHub Desktop.
Lint a Julia project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
for doc in LanguageServer.getdocuments_value(s) | |
StaticLint.check_all(LanguageServer.getcst(doc), s.lint_options, LanguageServer.getenv(doc, s)) | |
LanguageServer.mark_errors(doc, doc.diagnostics) | |
foreach(println, doc.diagnostics) | |
end |
Author
pfitzseb
commented
Mar 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment