/** * Clippy lens for Rust linting * * Clippy is the official Rust linter that catches common mistakes and improves code. * Output format: JSON Lines (one JSON object per line) with --message-format json * * @see https://doc.rust-lang.org/clippy/ */ import { BaseLens } from '../base/BaseLens.js'; import { LensResult, ExecuteResult } from '../../types/index.js'; /** * Clippy span location */ interface ClippySpan { file_name: string; byte_start: number; byte_end: number; line_start: number; line_end: number; column_start: number; column_end: number; is_primary: boolean; text: Array<{ text: string; highlight_start: number; highlight_end: number; }>; label: string | null; suggested_replacement: string | null; suggestion_applicability: string | null; expansion: unknown | null; } /** * Clippy diagnostic code */ interface ClippyCode { code: string; explanation: string | null; } /** * Clippy diagnostic message */ interface ClippyMessage { rendered: string; code: ClippyCode | null; level: 'error' | 'warning' | 'note' | 'help' | 'failure-note'; message: string; spans: ClippySpan[]; children: ClippyMessage[]; } /** * Clippy JSON line output (compiler-message reason) */ interface ClippyCompilerMessage { reason: 'compiler-message'; package_id: string; manifest_path: string; target: { kind: string[]; name: string; src_path: string; }; message: ClippyMessage; } /** * Parsed clippy output - array of compiler messages */ type ClippyOutput = ClippyCompilerMessage[]; /** * Lens for Clippy Rust linter */ export declare class ClippyLens extends BaseLens { readonly name = "clippy"; readonly description = "Rust linter (catches common mistakes)"; readonly languages: string[]; readonly supportedTools: string[]; readonly requirements: import("../..").LensRequirements; private pathMapper?; /** * Calculate quality score (0-100) from Clippy results * * Scoring algorithm: * - Start at 100 * - Subtract penalty based on issues per file analyzed * - Errors: 10 points per error per file * - Warnings: 3 points per warning per file * - Notes/help: 1 point per note per file * - Floor at 0 */ static calculateQualityScore(result: LensResult): number; /** * Parse Clippy JSON Lines output */ parse(output: ExecuteResult): ClippyOutput; /** * Format Clippy results to standard format */ format(parsed: ClippyOutput): LensResult; /** * Map Clippy severity level to standard severity */ private mapClippySeverity; /** * Categorize Clippy rules * * Clippy lint groups: * - clippy::correctness - code that is outright wrong or useless * - clippy::suspicious - code that is most likely wrong * - clippy::style - code that should be written in a more idiomatic way * - clippy::complexity - code that does something simple in a complex way * - clippy::perf - code that can be written to run faster * - clippy::pedantic - lints that are very strict or have false positives * - clippy::nursery - new lints that are still in development * - clippy::cargo - lints for Cargo.toml * * Rustc lints (not prefixed with clippy::): * - unused_* - unused code * - dead_code - unreachable code * - etc. */ private categorizeRule; /** * Get or create path mapper */ private getPathMapper; /** * Prepare command to ensure JSON output format */ prepareCommand(command: string): string; } export {}; //# sourceMappingURL=ClippyLens.d.ts.map