Struct ast_grep_config::SerializableRuleConfig
source · pub struct SerializableRuleConfig<L: Language> {
pub core: SerializableRuleCore<L>,
pub id: String,
pub message: String,
pub note: Option<String>,
pub severity: Severity,
pub transform: Option<HashMap<String, Transformation>>,
pub fix: Option<String>,
pub files: Option<Vec<String>>,
pub ignores: Option<Vec<String>>,
pub url: Option<String>,
pub metadata: Option<HashMap<String, String>>,
}Fields§
§core: SerializableRuleCore<L>§id: StringUnique, descriptive identifier, e.g., no-unused-variable
message: StringMain message highlighting why this rule fired. It should be single line and concise, but specific enough to be understood without additional context.
note: Option<String>Additional notes to elaborate the message and provide potential fix to the issue.
severity: SeverityOne of: hint, info, warning, or error
transform: Option<HashMap<String, Transformation>>A dictionary for meatvariable manipulation. Dict key is the new variable name. Dict value is a [transformation] that specifies how meta var is processed. Warning: this is experimental option. https://github.com/ast-grep/ast-grep/issues/436
fix: Option<String>A pattern to auto fix the issue. It can reference metavariables appeared in rule.
files: Option<Vec<String>>Glob patterns to specify that the rule only applies to matching files
ignores: Option<Vec<String>>Glob patterns that exclude rules from applying to files
url: Option<String>Documentation link to this rule
metadata: Option<HashMap<String, String>>Extra information for the rule
Methods from Deref<Target = SerializableRuleCore<L>>§
pub fn get_matcher( &self, globals: &GlobalRules<L> ) -> Result<RuleWithConstraint<L>, RuleConfigError>
Trait Implementations§
source§impl<L: Clone + Language> Clone for SerializableRuleConfig<L>
impl<L: Clone + Language> Clone for SerializableRuleConfig<L>
source§fn clone(&self) -> SerializableRuleConfig<L>
fn clone(&self) -> SerializableRuleConfig<L>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more