Newly tracked file
src/interface.jl
changed.
Other files ignored by Codecov
test/runtests.jl
has changed.
7 | 7 | end |
|
8 | 8 | ||
9 | 9 | """ |
|
10 | - | lint_string(s, server) |
|
10 | + | lint_string(s, server; gethints = false) |
|
11 | 11 | ||
12 | 12 | Parse a string and run a semantic pass over it. This will mark scopes, bindings, |
|
13 | - | references, and lint hints. An annotated `EXPR` is returned. |
|
13 | + | references, and lint hints. An annotated `EXPR` is returned or, if `gethints = true`, |
|
14 | + | it is paired with a collected list of errors/hints. |
|
14 | 15 | """ |
|
15 | - | function lint_string(s::String, server = setup_server()) |
|
16 | + | function lint_string(s::String, server = setup_server(); gethints = false) |
|
16 | 17 | empty!(server.files) |
|
17 | 18 | f = StaticLint.File("", s, CSTParser.parse(s, true), nothing, server) |
|
18 | 19 | StaticLint.setroot(f, f) |
|
19 | 20 | StaticLint.setfile(server, "", f) |
|
20 | 21 | StaticLint.semantic_pass(f) |
|
21 | 22 | StaticLint.check_all(f.cst, StaticLint.LintOptions(), server) |
|
22 | - | return f.cst |
|
23 | + | if gethints |
|
24 | + | return f.cst, [(x, string(haserror(x) ? LintCodeDescriptions[x.meta.error] : "Missing reference", " at offset ", offset)) for (offset, x) in collect_hints(f.cst, server)] |
|
25 | + | else |
|
26 | + | return f.cst |
|
27 | + | end |
|
23 | 28 | end |
|
24 | 29 | ||
25 | 30 | """ |
31 | 36 | are not handled, see `followinclude` for details). A `FileServer` will be returned |
|
32 | 37 | containing the `File`s of the package. |
|
33 | 38 | """ |
|
34 | - | function lint_file(rootpath, server = setup_server()) |
|
39 | + | function lint_file(rootpath, server = setup_server(); gethints = false) |
|
35 | 40 | empty!(server.files) |
|
36 | 41 | root = StaticLint.loadfile(server, rootpath) |
|
37 | 42 | StaticLint.semantic_pass(root) |
|
38 | 43 | for (p,f) in server.files |
|
39 | 44 | StaticLint.check_all(f.cst, StaticLint.LintOptions(), server) |
|
40 | 45 | end |
|
41 | - | return root |
|
42 | - | end |
Files | Coverage |
---|---|
src | 76.11% |
Project Totals (12 files) | 76.11% |