Skip to content

Commit 23cbdbb

Browse files
uploaded the github actions for linting
1 parent 43680ab commit 23cbdbb

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SwiftLint Configuration for IMA iOS DAI Examples
2+
3+
# Paths to include in linting
4+
included:
5+
- Swift
6+
7+
# Paths to exclude from linting
8+
excluded:
9+
- Pods
10+
- .build
11+
- DerivedData
12+
13+
# Rules to disable for example code
14+
disabled_rules:
15+
- trailing_whitespace # Example code may have formatting variations
16+
17+
# Opt-in rules to enable
18+
opt_in_rules:
19+
- empty_count # Prefer isEmpty over count == 0
20+
- empty_string # Prefer isEmpty over == ""
21+
- force_unwrapping # Catch force unwraps (!) which can crash
22+
- redundant_optional_initialization # Catch unnecessary = nil
23+
- explicit_init # Prefer .init() over direct initializer
24+
25+
# Configure rule thresholds
26+
line_length:
27+
warning: 120
28+
error: 150
29+
ignores_comments: true
30+
31+
function_body_length:
32+
warning: 60
33+
error: 100
34+
35+
file_length:
36+
warning: 500
37+
error: 800
38+
39+
type_body_length:
40+
warning: 300
41+
error: 500
42+
43+
# Identifier naming rules
44+
identifier_name:
45+
min_length:
46+
warning: 2
47+
max_length:
48+
warning: 50
49+
excluded:
50+
- id
51+
- ad
52+
53+
# Severity overrides
54+
force_cast: warning # Allow force casts with warning in examples
55+
force_try: warning # Allow force try with warning in examples
56+
57+
# Reporter type
58+
reporter: "xcode"
59+

.github/workflows/lint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: SwiftLint
2+
3+
# Run on pull-requests or pushes to main
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'Swift/**/*.swift'
10+
- '.github/workflows/build/.swiftlint.yml'
11+
- '.github/workflows/lint.yml'
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- 'Swift/**/*.swift'
17+
- '.github/workflows/build/.swiftlint.yml'
18+
- '.github/workflows/lint.yml'
19+
20+
jobs:
21+
swiftlint:
22+
name: SwiftLint
23+
runs-on: macos-latest
24+
steps:
25+
- name: Clone repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install SwiftLint
29+
run: brew install swiftlint
30+
31+
- name: SwiftLint version
32+
run: swiftlint version
33+
34+
- name: Lint Swift code
35+
run: swiftlint lint --config .github/workflows/build/.swiftlint.yml --strict --reporter github-actions-logging
36+

0 commit comments

Comments
 (0)