Skip to content

Commit 7362795

Browse files
authored
Swift Linting (#51)
* feat: Introduce SwiftLint configuration and a dedicated CI workflow, while updating the existing Swift CI and adding an `act` configuration. * Enhance comment for ast.proto resource Updated comment to provide additional context about ast.proto. * added workflow_dispatch to force running on non-main branches * added wildcard for all branches linting * pivoted to not manually doing linting using marketplace * chore: add .actrc for local CI simulation and update SwiftLint GitHub Action. * Added leniency for test files and such
1 parent c5b1378 commit 7362795

4 files changed

Lines changed: 82 additions & 4 deletions

File tree

.github/workflows/lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: lint
2+
3+
on:
4+
workflow_dispatch: # Manual trigger from GitHub UI
5+
push:
6+
branches: ['**']
7+
paths:
8+
- '**.swift'
9+
- '.swiftlint.yml'
10+
- '.github/workflows/lint.yml'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- '**.swift'
15+
- '.swiftlint.yml'
16+
- '.github/workflows/lint.yml'
17+
18+
jobs:
19+
swiftlint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: SwiftLint
25+
uses: norio-nomura/action-swiftlint@3.2.1
26+
with:
27+
args: --reporter github-actions-logging --lenient

.github/workflows/swift.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: build_test
22

33
on:
4+
workflow_dispatch: # Manual trigger from GitHub UI
45
push:
5-
branches: [ main ]
6+
branches: ['**']
67
pull_request:
78
branches: [ main ]
89

@@ -40,8 +41,8 @@ jobs:
4041
tar xzf swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz
4142
mv swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04 /opt/swift
4243
rm swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz
43-
export PATH="/opt/swift/usr/bin:${PATH}"
44-
- uses: actions/checkout@v2
44+
echo "/opt/swift/usr/bin" >> $GITHUB_PATH
45+
- uses: actions/checkout@v4
4546
- name: Build
4647
run: swift build -c ${{ matrix.kind }} -v
4748
- name: Install protobuf

.swiftlint.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# SwiftLint Configuration for Fuzzilli
2+
# https://github.com/realm/SwiftLint
3+
4+
excluded:
5+
- .build
6+
- .venv
7+
- v8
8+
- v8_patch
9+
- Targets
10+
- Package.swift
11+
- "**/*.pb.swift"
12+
- "**/*Test*"
13+
14+
disabled_rules:
15+
- trailing_whitespace
16+
- line_length
17+
- file_length
18+
- type_body_length
19+
- function_body_length
20+
- cyclomatic_complexity
21+
- identifier_name
22+
- large_tuple
23+
- nesting
24+
- force_cast
25+
- force_try
26+
- force_unwrapping
27+
- todo
28+
- opening_brace
29+
- trailing_comma
30+
31+
opt_in_rules:
32+
- empty_count
33+
- empty_string
34+
- fatal_error_message
35+
- first_where
36+
- overridden_super_call
37+
- redundant_nil_coalescing
38+
- sorted_first_last
39+
- yoda_condition
40+
- contains_over_first_not_nil
41+
42+
function_parameter_count:
43+
warning: 8
44+
error: 10
45+
46+
type_name:
47+
min_length: 2
48+
max_length: 50
49+
50+
reporter: "github-actions-logging"

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ let package = Package(
6363
"Protobuf/README.md",
6464
"Protobuf/gen_programproto.py"],
6565
resources: [
66-
// The ast.proto file is required by the node.js parser
66+
// The ast.proto file is required by the node.js parser and stuff
6767
.copy("Protobuf/ast.proto"),
6868
.copy("Compiler/Parser")]),
6969

0 commit comments

Comments
 (0)