Syntax Reference

Main

StaticLint.followincludeMethod
followinclude(x, state)

Checks whether the arguments of a call to include can be resolved to a path. If successful it checks whether a file with that path is loaded on the server or a file exists on the disc that can be loaded. If this is successful it traverses the code associated with the loaded file.

source
StaticLint.traverseMethod
traverse(x, state)

Iterates across the child nodes of an EXPR in execution order (rather than storage order) calling state on each node.

source
StaticLint.lint_fileFunction
lint_file(rootpath, server)

Read a file from disc, parse and run a semantic pass over it. The file should be the root of a project, e.g. for this package that file is src/StaticLint.jl. Other files in the project will be loaded automatically (calls to include with complicated arguments are not handled, see followinclude for details). A FileServer will be returned containing the Files of the package.

source
StaticLint.lint_stringFunction
lint_string(s, server; gethints = false)

Parse a string and run a semantic pass over it. This will mark scopes, bindings, references, and lint hints. An annotated EXPR is returned or, if gethints = true, it is paired with a collected list of errors/hints.

source
StaticLint.interpret_evalMethod

interpret_eval(x::EXPR, state)

Naive attempt to interpret x as though it has been eval'ed. Lifts any bindings made within the scope of x to the toplevel and replaces (some) interpolated binding names with the value where possible.

source
StaticLint.initial_pass_on_exportsMethod
initial_pass_on_exports(x::EXPR, server)

Export statements need to be (pseudo) evaluated each time we consider whether a variable is made available by an import statement.

source
StaticLint.module_safety_tripMethod
module_safety_trip(scope::Scope,  visited_scopes)

Checks whether the scope is a module and we've visited it before, otherwise adds the module to the list.

source
StaticLint.resolve_getfieldMethod
resolve_getfield(x::EXPR, parent::Union{EXPR,Scope,ModuleStore,Binding}, state::State)::Bool

Given an expression of the form parent.x try to resolve x. The method called with parent::EXPR resolves the reference for parent, other methods then check whether the Binding/Scope/ModuleStore to which parent points has a field matching x.

source
StaticLint.valofidMethod
valofid(x)

Returns the string value of an expression for which isidentifier is true, i.e. handles NONSTDIDENTIFIERs.

source
StaticLint.scopesMethod
scopes(x::EXPR, state)

Called when traversing the syntax tree and handles the association of scopes with expressions. On the first pass this will add scopes as necessary, on following passes it empties it.

source
StaticLint.get_pathMethod
get_path(x::EXPR)

Usually called on the argument to include calls, and attempts to determine the path of the file to be included. Has limited support for joinpath calls.

source

Linting

StaticLint.check_kw_defaultMethod
check_kw_default(x::EXPR, server)

Check that the default value matches the type for keyword arguments. Following types are checked: String, Symbol, Int, Char, Bool, Float32, Float64, UInt8, UInt16, UInt32, UInt64, UInt128.

source
StaticLint.collect_hintsFunction

collect_hints(x::EXPR, server, missingrefs = :all, isquoted = false, errs = Tuple{Int,EXPR}[], pos = 0)

Collect hints and errors from an expression. missingrefs = (:none, :id, :all) determines whether unresolved identifiers are marked, the :all option will mark identifiers used in getfield calls."

source