pub struct LintEngine { /* private fields */ }Expand description
Main entry point for linting Lua source code.
§Example
use mlua_check::{LintEngine, LintConfig, LintPolicy};
let mut engine = LintEngine::new();
engine.symbols_mut().add_global("alc");
engine.symbols_mut().add_global_field("alc", "llm");
let result = engine.lint("alc.llm_call('hello')", "@main.lua");
assert!(result.has_errors() || result.warning_count > 0);Implementations§
Source§impl LintEngine
impl LintEngine
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new engine with Lua 5.4 stdlib pre-populated and default config (policy: Warn).
Sourcepub fn with_config(config: LintConfig) -> Self
pub fn with_config(config: LintConfig) -> Self
Create with a specific config.
Sourcepub fn symbols_mut(&mut self) -> &mut SymbolTable
pub fn symbols_mut(&mut self) -> &mut SymbolTable
Mutable access to the symbol table for registration.
Sourcepub fn symbols(&self) -> &SymbolTable
pub fn symbols(&self) -> &SymbolTable
Immutable access to the symbol table.
Sourcepub fn config_mut(&mut self) -> &mut LintConfig
pub fn config_mut(&mut self) -> &mut LintConfig
Mutable access to config.
Sourcepub fn lint(&self, source: &str, _chunk_name: &str) -> LintResult
pub fn lint(&self, source: &str, _chunk_name: &str) -> LintResult
Run all enabled lint rules on the given source code.
_chunk_name is reserved for future use in multi-file analysis.
Trait Implementations§
Source§impl Clone for LintEngine
impl Clone for LintEngine
Source§fn clone(&self) -> LintEngine
fn clone(&self) -> LintEngine
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LintEngine
impl Debug for LintEngine
Auto Trait Implementations§
impl Freeze for LintEngine
impl RefUnwindSafe for LintEngine
impl Send for LintEngine
impl Sync for LintEngine
impl Unpin for LintEngine
impl UnsafeUnpin for LintEngine
impl UnwindSafe for LintEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more