Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SwiftLint Configuration for IMA iOS DAI Examples

# Paths to exclude from linting
excluded:
- Pods
- .build
- DerivedData

# Rules to disable for example code
disabled_rules:
- trailing_whitespace # Example code may have formatting variations
- unneeded_break_in_switch # Common in example code for clarity

# Opt-in rules to enable
opt_in_rules:
- empty_count # Prefer isEmpty over count == 0
- empty_string # Prefer isEmpty over == ""
- implicit_optional_initialization # Catch unnecessary = nil

# Configure rule thresholds
line_length:
warning: 150
error: 250
ignores_comments: true
ignores_urls: true

function_body_length:
warning: 60
error: 100

file_length:
warning: 500
error: 800

type_body_length:
warning: 300
error: 500

# Identifier naming rules
identifier_name:
min_length:
warning: 2
max_length:
warning: 50
excluded:
- id
- ad

# Severity overrides
force_cast: warning # Allow force casts with warning in examples
force_try: warning # Allow force try with warning in examples

# Reporter type
reporter: "xcode"

37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SwiftLint

# Run on pull-requests or pushes to main
on:
push:
branches:
- main
paths:
- 'Swift/**/*.swift'
- '.github/workflows/build/.swiftlint.yml'
- '.github/workflows/lint.yml'
pull_request:
branches:
- main
paths:
- 'Swift/**/*.swift'
- '.github/workflows/build/.swiftlint.yml'
- '.github/workflows/lint.yml'
workflow_dispatch: # Allow manual triggering

jobs:
swiftlint:
name: SwiftLint
runs-on: macos-latest
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install SwiftLint
run: brew install swiftlint

- name: SwiftLint version
run: swiftlint version

- name: Lint Swift code
run: swiftlint lint Swift --config .github/workflows/build/.swiftlint.yml --reporter github-actions-logging