Skip to main content

Crate swizzy

Crate swizzy 

Source
Expand description

§swizzy

A fast, developer-friendly SwiftLint output formatter that groups issues by file and provides clickable file paths for editor integration.

§Features

  • Grouped Output: Issues are organized by file for better readability
  • Editor Integration: File paths with line numbers are clickable in most editors/IDEs
  • Smart Colors: Automatically disables colors when output is redirected
  • Zero Configuration: Works out of the box with SwiftLint JSON output
  • Fast Performance: Built with Rust for maximum speed
  • Flexible Input: Accepts piped input or runs SwiftLint directly

§Usage

# Pipe SwiftLint JSON output to swizzy
swiftlint lint --reporter json | swizzy

# Run from a directory containing Swift source files
swizzy

§Exit Codes

  • 0: No issues found or successfully processed
  • 1: Issues were found and reported

§Library Usage

While swizzy is primarily a command-line tool, its core functionality is available as a library for integration into other Rust applications:

use swizzy::{parse_swiftlint_output, group_issues_by_file, format_issues_output};

let json_input = r#"[{"file": "test.swift", "line": 1, "severity": "warning", "reason": "Test issue", "rule_id": null}]"#;
let issues = parse_swiftlint_output(json_input).unwrap();
let grouped = group_issues_by_file(issues);
let (formatted, count) = format_issues_output(grouped, false);
println!("{}", formatted);

Structs§

SwiftlintIssue
Represents a single SwiftLint issue parsed from JSON output.

Functions§

format_issue
Formats a single SwiftLint issue for display.
format_issues_output
Formats all grouped SwiftLint issues for display.
group_issues_by_file
Groups SwiftLint issues by their file path.
parse_swiftlint_output
Parses SwiftLint JSON output into a vector of issues.