SwiftLint

Swift linting and style enforcement tool — enforces Swift style guide rules, catches common bugs, and maintains code quality. SwiftLint runs as Xcode build phase script or CLI. Configuration via .swiftlint.yml: disabled_rules, opt_in_rules, included/excluded paths, rule-specific configuration (line_length: 120). Rules: style (trailing_whitespace, colon, opening_brace), idiomatic (force_cast, force_try, implicitly_unwrapped_optional), metrics (function_body_length, file_length), lint (unused_import, unused_closure_parameter). Xcode integration shows warnings/errors inline. Supports SwiftFormat integration and custom regex rules. Essential for consistent agent iOS codebase.

Evaluated Mar 06, 2026 (0d ago) v0.57.x
Homepage ↗ Repo ↗ Developer Tools swift ios macos linting static-analysis code-style xcode ci
⚙ Agent Friendliness
70
/ 100
Can an agent use this?
🔒 Security
93
/ 100
Is it safe for agents?
⚡ Reliability
87
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
90
Error Messages
88
Auth Simplicity
98
Rate Limits
98

🔒 Security

TLS Enforcement
95
Auth Strength
95
Scope Granularity
90
Dep. Hygiene
88
Secret Handling
95

SwiftLint can enforce security-relevant rules — force_try:error prevents ignored errors that cause agent app crashes; implicitly_unwrapped_optional catches unsafe force-unwraps. Add custom_rules to detect hardcoded agent API keys or secrets in source files as part of agent security pipeline.

⚡ Reliability

Uptime/SLA
92
Version Stability
85
Breaking Changes
82
Error Recovery
90
AF Security Reliability

Best When

You have a Swift iOS agent codebase with multiple contributors and want consistent code style, automatic quality enforcement in CI, and early detection of unsafe patterns like force_try.

Avoid When

Your agent codebase is solo-maintained with consistent personal style, you use SwiftFormat already (overlap), or you need runtime analysis rather than static checking.

Use Cases

  • Enforce agent iOS code style in Xcode — SwiftLint Xcode build phase shows inline warnings for style violations in agent source files; team sees linting issues before code review, not after
  • CI/CD pipeline Swift quality gate — swiftlint lint --reporter json in GitHub Actions fails build on agent code style violations; enforces standards across distributed agent iOS team without manual code review
  • Custom agent naming convention rules — custom_rules in .swiftlint.yml enforces AgentService/AgentRepository naming patterns with regex matching; catch convention violations automatically in agent iOS architecture
  • Prevent force_cast and force_try in agent code — force_cast: error and force_try: error rules prevent unsafe Swift patterns that cause agent app crashes; SwiftLint surfaces these as build errors not warnings
  • File structure enforcement for agent modules — file_length: warning: 400, error: 600 and function_body_length rules keep agent service files focused; prevents agent monolithic view controllers from growing unchecked

Not For

  • Runtime error detection — SwiftLint is static analysis; it catches style and common patterns but not logic bugs, memory leaks, or agent runtime issues; use Instruments and unit tests for runtime analysis
  • Non-Swift codebases — SwiftLint is Swift-specific; use ESLint for TypeScript agent tools, Rubocop for Ruby, or Detekt for Kotlin
  • Automatic reformatting — SwiftLint can auto-correct some violations but is not a full formatter; use SwiftFormat for comprehensive auto-formatting of agent code alongside SwiftLint for rule checking

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
No
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

CLI tool — no auth. Runs locally or in CI against Swift source files.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

SwiftLint is MIT licensed, maintained by Realm (MongoDB). Free for all use.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Xcode build phase must run SwiftLint before compile — place SwiftLint Run Script build phase before 'Compile Sources' to see violations in context; after compile, Xcode may show violations on wrong lines due to build artifact interference for agent source files
  • SwiftLint version must match across team — .swiftlint.yml rule availability changes between versions; agent team members on different SwiftLint versions see different violations; pin version in Brewfile or use SPM plugin to ensure consistent linting across agent developer machines and CI
  • disabled_rules whitelist vs opt_in_rules — SwiftLint has enabled-by-default rules and opt-in rules; opt_in_rules must be explicitly enabled; force_unwrapping and implicitly_unwrapped_optional are opt-in; common agent code safety rules are not enabled by default without explicit opt_in_rules configuration
  • Excluded paths must match Xcode project structure — excluded in .swiftlint.yml uses relative paths from .swiftlint.yml location; if file is at wrong path level, exclusions silently fail and Pods/ or generated agent files get linted; run swiftlint --path . in terminal to debug exclusion effectiveness
  • custom_rules regex must be valid RE2 syntax — invalid regex in custom_rules causes SwiftLint to silently skip rule or crash; test custom rule regex with swiftlint rules --config .swiftlint.yml before adding to agent CI pipeline; complex capture groups not supported
  • swiftlint autocorrect modifies files in place — running swiftlint autocorrect without --dry-run modifies agent source files immediately; in CI, only run autocorrect in dedicated fixup step, not in build validation; running autocorrect during PR check modifies files in worker and creates dirty git state

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for SwiftLint.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered