Syntax Reference
StaticLint.addmoduletoscope!StaticLint.check_kw_defaultStaticLint.collect_hintsStaticLint.eventually_overloadsStaticLint.followincludeStaticLint.get_parent_fexprStaticLint.get_pathStaticLint.initial_pass_on_exportsStaticLint.interpret_evalStaticLint.introduces_scopeStaticLint.is_in_fexprStaticLint.lint_fileStaticLint.lint_stringStaticLint.maybe_quoted_listStaticLint.module_safety_tripStaticLint.new_within_structStaticLint.resolve_getfieldStaticLint.scope_exportsStaticLint.scopehasbindingStaticLint.scopehasmoduleStaticLint.scopesStaticLint.traverseStaticLint.valofid
Main
StaticLint.followinclude — Methodfollowinclude(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.
StaticLint.traverse — Methodtraverse(x, state)Iterates across the child nodes of an EXPR in execution order (rather than storage order) calling state on each node.
StaticLint.eventually_overloads — Methodeventually_overloads(b, x, server)
StaticLint.lint_file — Functionlint_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.
StaticLint.lint_string — Functionlint_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.
StaticLint.interpret_eval — Methodinterpret_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.
StaticLint.maybe_quoted_list — Methodmaybe_quoted_list(x::EXPR)Try and get a list of quoted symbols from x. Return nothing if not possible.
StaticLint.initial_pass_on_exports — Methodinitial_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.
StaticLint.module_safety_trip — Methodmodule_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.
StaticLint.new_within_struct — Methodnewwithinstruct(x::EXPR)
Checks whether x is a reference to new within a datatype constructor.
StaticLint.resolve_getfield — Methodresolve_getfield(x::EXPR, parent::Union{EXPR,Scope,ModuleStore,Binding}, state::State)::BoolGiven 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.
StaticLint.scope_exports — Methodscope_exports(scope::Scope, name::String)Does the scope export a variable called name?
StaticLint.valofid — Methodvalofid(x)Returns the string value of an expression for which isidentifier is true, i.e. handles NONSTDIDENTIFIERs.
StaticLint.addmoduletoscope! — Methodaddmoduletoscope!(s, m, [mname::Symbol])Adds module m to the list of used modules in scope s.
StaticLint.introduces_scope — Methodintroduces_scope(x::EXPR, state)Does this expression introduce a new scope?
StaticLint.scopehasbinding — Methodscopehasbinding(s::Scope, n::String)Checks whether s has a binding for variable named n.
StaticLint.scopehasmodule — Methodscopehasmodule(s::Scope, mname::Symbol)::Bool
Checks whether the module mname has been usinged in s.
StaticLint.scopes — Methodscopes(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.
StaticLint.get_path — Methodget_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.
StaticLint.get_parent_fexpr — Methodget_in_fexpr(x::EXPR, f)Get the parent of x for which f(parent) == true. (isinfexpr should be called first.)
StaticLint.is_in_fexpr — Methodis_in_fexpr(x::EXPR, f)Check whether x isa the child of an expression for which f(parent) == true.
Linting
StaticLint.check_kw_default — Methodcheck_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.
StaticLint.collect_hints — Functioncollect_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."