Skip to main content

sqruff_lib/core/linter/
common.rs

1use sqruff_lib_core::errors::{SQLBaseError, SQLTemplaterError};
2use sqruff_lib_core::parser::segments::ErasedSegment;
3use sqruff_lib_core::templaters::TemplatedFile;
4
5/// An object to store the result of a templated file/string.
6///
7/// This is notable as it's the intermediate state between what happens
8/// in the main process and the child processes when running in parallel mode.
9#[derive(Debug, Clone)]
10pub struct RenderedFile {
11    pub templated_file: TemplatedFile,
12    pub templater_violations: Vec<SQLTemplaterError>,
13    pub(crate) filename: String,
14    pub source_str: String,
15}
16
17/// Result of batch rendering: either a rendered file or a skipped file.
18pub enum BatchRenderedResult {
19    Rendered(RenderedFile),
20    Skipped { filename: String, reason: String },
21}
22
23/// An object to store the result of parsing a string.
24#[derive(Debug, Clone)]
25pub struct ParsedString {
26    pub tree: Option<ErasedSegment>,
27    pub violations: Vec<SQLBaseError>,
28    pub templated_file: TemplatedFile,
29    pub filename: String,
30    pub source_str: String,
31}