/** * rustfmt lens for Rust code formatting * * rustfmt is the official Rust code formatter. * Output format: With --check flag, outputs file paths that need formatting. * * @see https://rust-lang.github.io/rustfmt/ */ import { BaseLens } from '../base/BaseLens.js'; import { LensResult, ExecuteResult } from '../../types/index.js'; /** * Parsed rustfmt output */ interface RustfmtParsedOutput { /** Files that need formatting */ filesNeedingFormatting: string[]; /** Total files checked (if available) */ filesChecked: number; } /** * Lens for rustfmt Rust formatter */ export declare class RustfmtLens extends BaseLens { readonly name = "rustfmt"; readonly description = "Rust code formatter"; readonly languages: string[]; readonly supportedTools: string[]; readonly requirements: import("../..").LensRequirements; private pathMapper?; /** * Calculate quality score (0-100) from rustfmt results * * Scoring algorithm: * - Start at 100 * - Subtract penalty based on percentage of files needing formatting * - Formula: 100 - (filesNeedingFormatting / filesChecked * 100) * - Floor at 0 */ static calculateQualityScore(result: LensResult): number; /** * Parse rustfmt --check output * * When using `cargo fmt --check`, the output shows: * - Diff output for files that need formatting * - "Diff in " lines indicate files needing formatting * * When using `cargo fmt -- --check`, with exit code: * - 0: All files formatted correctly * - 1: Some files need formatting * * The output to stderr looks like: * Diff in /path/to/file.rs at line 10: * -old line * +new line */ parse(output: ExecuteResult): RustfmtParsedOutput; /** * Format rustfmt results to standard format */ format(parsed: RustfmtParsedOutput): LensResult; /** * Get or create path mapper */ private getPathMapper; /** * Prepare command to ensure --check flag */ prepareCommand(command: string): string; } export {}; //# sourceMappingURL=RustfmtLens.d.ts.map