pub struct ConstantParameter {Show 16 fields
pub path: PathBuf,
pub function_name: String,
pub parameter_name: String,
pub parameter_index: u32,
pub option_key: Option<String>,
pub line: u32,
pub col: u32,
pub reason: ConstantParameterReason,
pub evidence: Option<ConstantParameterEvidence>,
pub value: Option<ConstantParameterValue>,
pub optional: bool,
pub has_default: bool,
pub condition_reads: u32,
pub call_site_count: u32,
pub inspected_call_sites: Vec<ConstantParameterCallSite>,
pub explanation: String,
}Expand description
A parameter that each visible call of its function passes in one way.
Fields§
§path: PathBufSource path of the function.
function_name: StringThe module-scope binding name of the function. For a method of an
exported class, which only type-aware mode reports, Class.method.
parameter_name: StringThe parameter name. For an option key, the local binding of the key
in the object pattern: abort for { signal: abort }.
parameter_index: u320-based index of the parameter. A TypeScript this parameter does
not count.
option_key: Option<String>The property key, when the finding is about one key of an
object-pattern parameter: retries in { retries = 3 }. Absent for
a plain parameter.
line: u321-based line of the parameter, or of the key binding.
col: u320-based byte column of the parameter, or of the key binding.
reason: ConstantParameterReasonWhy the rule reports the parameter.
evidence: Option<ConstantParameterEvidence>The evidence that the finding needs beyond the syntactic call facts. Absent for a finding that the call facts prove alone.
value: Option<ConstantParameterValue>The value that each call passes. Present if and only if reason is
identical-argument.
optional: booltrue when the parameter has the TypeScript ? marker.
has_default: booltrue when the parameter, or the option key, has a default value.
condition_reads: u32The count of conditional tests in the function whose test is the
parameter, !parameter or !!parameter: the test of an if, a
?:, a while, a do or a for. Nested functions count. A
comparison such as parameter === true and an operand of && or
|| do not count.
call_site_count: u32The count of calls that the rule read for this parameter. A recursive call that passes the parameter on unchanged does not count.
inspected_call_sites: Vec<ConstantParameterCallSite>The first calls in source order, at most 20. The list is never longer
than call_site_count.
explanation: StringWhat the finding means and what static analysis does not prove.