Documentation
¶
Index ¶
- func ApplyAllFixesColumns(columns *scanner.FindingColumns, suffix string) (totalFixes int, filesModified int, errors []error)
- func ApplyBinaryFixesBatchColumns(columns *scanner.FindingColumns, dryRun bool, searchDirs ...[]string) (applied int, errors []error)
- func SetLogger(l logger.Logger)
- func ValidateBinaryFix(fix *scanner.BinaryFix, searchDirs []string) ([]android.FileReference, error)
- func ValidateFixResult(path string, original, fixed []byte) error
- type DroppedFix
- type FixResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAllFixesColumns ¶
func ApplyAllFixesColumns(columns *scanner.FindingColumns, suffix string) (totalFixes int, filesModified int, errors []error)
ApplyAllFixesColumns applies text fixes from columnar findings across all files. It reconstructs only rows that carry text fixes, preserving the existing file-level fixer behavior without materializing the entire finding set.
func ApplyBinaryFixesBatchColumns ¶
func ApplyBinaryFixesBatchColumns(columns *scanner.FindingColumns, dryRun bool, searchDirs ...[]string) (applied int, errors []error)
ApplyBinaryFixesBatchColumns applies binary fixes from columnar findings in the same safe order as ApplyBinaryFixesBatch, working directly with columnar data.
func ValidateBinaryFix ¶
func ValidateBinaryFix(fix *scanner.BinaryFix, searchDirs []string) ([]android.FileReference, error)
ValidateBinaryFix checks whether a BinaryFix can be safely applied. For WebP conversions it performs three checks:
Animated asset detection: animated GIFs and APNGs cannot be safely converted to static WebP. If the source is animated, an error is returned.
MinSdk compatibility: WebP lossy requires API 14, WebP lossless/transparency requires API 18. If BinaryFix.MinSdk is set and below the threshold, an error is returned.
Direct file reference scan: scans Kotlin, Java, and XML files for literal occurrences of the source file name (e.g. "icon.png"). Android resource references like "@drawable/icon" are safe because they resolve by name without extension, but direct file-name strings would break after conversion.
Returns (nil, error) for safety failures (animated, minSdk). Returns (refs, nil) when direct file references are found (caller decides). Returns (nil, nil) when the fix is safe.
func ValidateFixResult ¶
ValidateFixResult checks whether the given content (for a .kt file) still parses without additional errors compared to the original. This is opt-in validation.
Types ¶
type DroppedFix ¶
DroppedFix records a fix that was dropped due to overlap conflict.
type FixResult ¶
type FixResult struct {
Applied int
DroppedFixes []DroppedFix
}
FixResult holds the result of applying fixes to a file.