Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftLint build plugin #2233

Merged
merged 18 commits into from
Dec 18, 2023
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
-target "DuckDuckGo" \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4"
-skipPackagePluginValidation \

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
| tee xcodebuild.log

- name: Release tests
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
-scheme "AtbUITests" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml

Expand Down Expand Up @@ -87,6 +88,7 @@ jobs:
-scheme "FingerprintingUITests" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml

- name: Publish unit tests report
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: SwiftLint
uses: docker://norionomura/swiftlint:0.53.0
uses: docker://norionomura/swiftlint:0.54.0_swift-5.9.0
with:
args: swiftlint --reporter github-actions-logging --strict

Expand Down Expand Up @@ -81,6 +81,7 @@ jobs:
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
DDG_SLOW_COMPILE_CHECK_THRESHOLD=250 \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml
Expand Down Expand Up @@ -183,6 +184,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 14" \
-derivedDataPath "DerivedData" \
-configuration "Release" \
-skipPackagePluginValidation \
| xcbeautify

create-asana-task:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
| tee xcodebuild.log

- name: Create test account for Sync and return the recovery code
Expand Down
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
allow_zero_lintable_files: true

disabled_rules:
- discarded_notification_center_observer
- notification_center_detachment
Expand Down
112 changes: 111 additions & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5374,6 +5374,7 @@
buildRules = (
);
dependencies = (
B6080BB52B20B03800B418EF /* PBXTargetDependency */,
4B470EE7299C6DFB0086EBDC /* PBXTargetDependency */,
);
name = PacketTunnelProvider;
Expand All @@ -5395,6 +5396,7 @@
buildRules = (
);
dependencies = (
B6080BBD2B20B05000B418EF /* PBXTargetDependency */,
025CCFE82582601C001CD5BB /* PBXTargetDependency */,
);
name = FingerprintingUITests;
Expand All @@ -5414,6 +5416,7 @@
buildRules = (
);
dependencies = (
B6080BAF2B20B02800B418EF /* PBXTargetDependency */,
);
name = ShareExtension;
productName = ShareExtension;
Expand All @@ -5440,6 +5443,7 @@
buildRules = (
);
dependencies = (
B6080BAD2B20B02400B418EF /* PBXTargetDependency */,
F143C2EA1E4A4CD400CFDE3A /* PBXTargetDependency */,
8390447520BDCE10006461CD /* PBXTargetDependency */,
85482D932462DCD100EDEDD1 /* PBXTargetDependency */,
Expand Down Expand Up @@ -5472,6 +5476,7 @@
buildRules = (
);
dependencies = (
B6080BBB2B20B04D00B418EF /* PBXTargetDependency */,
84E341A81E2F7EFB00BDBA6F /* PBXTargetDependency */,
);
name = UnitTests;
Expand All @@ -5495,6 +5500,7 @@
buildRules = (
);
dependencies = (
B6080BB32B20B03400B418EF /* PBXTargetDependency */,
85DF714924F7FE6100C89288 /* PBXTargetDependency */,
);
name = WidgetsExtension;
Expand All @@ -5516,6 +5522,7 @@
buildRules = (
);
dependencies = (
B6080BB12B20B02B00B418EF /* PBXTargetDependency */,
);
name = OpenAction;
productName = OpenAction;
Expand All @@ -5533,6 +5540,7 @@
buildRules = (
);
dependencies = (
B6080BBF2B20B05300B418EF /* PBXTargetDependency */,
85D33FD125C97B6E002B91A6 /* PBXTargetDependency */,
);
name = IntegrationTests;
Expand All @@ -5555,6 +5563,7 @@
buildRules = (
);
dependencies = (
B6080BB92B20B04A00B418EF /* PBXTargetDependency */,
85F21DB3210F5E32002631A6 /* PBXTargetDependency */,
);
name = AtbUITests;
Expand All @@ -5576,6 +5585,7 @@
buildRules = (
);
dependencies = (
B6080BC12B20B05600B418EF /* PBXTargetDependency */,
9825F9CC293F2DE900F220F2 /* PBXTargetDependency */,
);
name = PerformanceTests;
Expand Down Expand Up @@ -5612,6 +5622,7 @@
buildRules = (
);
dependencies = (
B6080BB72B20B03B00B418EF /* PBXTargetDependency */,
);
name = Core;
packageProductDependencies = (
Expand Down Expand Up @@ -6996,6 +7007,50 @@
target = 84E341911E2F7EFB00BDBA6F /* DuckDuckGo */;
targetProxy = 9825F9CD293F2DE900F220F2 /* PBXContainerItemProxy */;
};
B6080BAD2B20B02400B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BAC2B20B02400B418EF /* SwiftLintPlugin */;
};
B6080BAF2B20B02800B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BAE2B20B02800B418EF /* SwiftLintPlugin */;
};
B6080BB12B20B02B00B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BB02B20B02B00B418EF /* SwiftLintPlugin */;
};
B6080BB32B20B03400B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BB22B20B03400B418EF /* SwiftLintPlugin */;
};
B6080BB52B20B03800B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BB42B20B03800B418EF /* SwiftLintPlugin */;
};
B6080BB72B20B03B00B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BB62B20B03B00B418EF /* SwiftLintPlugin */;
};
B6080BB92B20B04A00B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BB82B20B04A00B418EF /* SwiftLintPlugin */;
};
B6080BBB2B20B04D00B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BBA2B20B04D00B418EF /* SwiftLintPlugin */;
};
B6080BBD2B20B05000B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BBC2B20B05000B418EF /* SwiftLintPlugin */;
};
B6080BBF2B20B05300B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BBE2B20B05300B418EF /* SwiftLintPlugin */;
};
B6080BC12B20B05600B418EF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = B6080BC02B20B05600B418EF /* SwiftLintPlugin */;
};
F143C2EA1E4A4CD400CFDE3A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F143C2E31E4A4CD400CFDE3A /* Core */;
Expand Down Expand Up @@ -9166,7 +9221,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 94.0.2;
version = 94.0.3;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down Expand Up @@ -9317,6 +9372,61 @@
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Bookmarks;
};
B6080BAC2B20B02400B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BAE2B20B02800B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BB02B20B02B00B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BB22B20B03400B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BB42B20B03800B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BB62B20B03B00B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BB82B20B04A00B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BBA2B20B04D00B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BBC2B20B05000B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BBE2B20B05300B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
B6080BC02B20B05600B418EF /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = "plugin:SwiftLintPlugin";
};
C14882EC27F211A000D59F0C /* SwiftSoup */ = {
isa = XCSwiftPackageProductDependency;
package = C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "861b8a72930f138cd18b6a7722502a8a40375827",
"version": "94.0.2"
"revision": "d07e18b3785d31c15364e56bdd2cb4b27edd35d0",
"version": "94.0.3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/AutocompleteRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AutocompleteRequest {
var request = URLRequest.developerInitiated(url)
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders

task = AutocompleteRequest.session.dataTask(with: request) { [weak self] (data, _, error) -> Void in
task = AutocompleteRequest.session.dataTask(with: request) { [weak self] (data, _, error) in
guard let weakSelf = self else { return }
do {
let suggestions = try weakSelf.processResult(data: data, error: error)
Expand Down
13 changes: 10 additions & 3 deletions LocalPackages/DuckUI/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.7
// Package.swift
// DuckDuckGo
//
Expand Down Expand Up @@ -30,10 +30,17 @@ let package = Package(
name: "DuckUI",
targets: ["DuckUI"])
],
dependencies: [],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"),
],
targets: [
.target(
name: "DuckUI",
dependencies: [])
dependencies: [],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug))
],
plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")]
)
]
)
8 changes: 7 additions & 1 deletion LocalPackages/SyncUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let package = Package(
],
dependencies: [
.package(path: "../DuckUI"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"),
.package(url: "https://github.com/duckduckgo/DesignResourcesKit", exact: "2.0.0")
],
targets: [
Expand All @@ -40,6 +41,11 @@ let package = Package(
dependencies: [
.product(name: "DuckUI", package: "DuckUI"),
"DesignResourcesKit"
])
],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug))
],
plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")]
)
]
)
19 changes: 16 additions & 3 deletions LocalPackages/Waitlist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,30 @@ let package = Package(
targets: ["Waitlist", "WaitlistMocks"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"),
.package(url: "https://github.com/duckduckgo/DesignResourcesKit", exact: "2.0.0")
],
targets: [
.target(
name: "Waitlist",
dependencies: ["DesignResourcesKit"]),
dependencies: ["DesignResourcesKit"],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug))
],
plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")]
),
.target(
name: "WaitlistMocks",
dependencies: ["Waitlist"]),
dependencies: ["Waitlist"],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug))
],
plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")]
),
.testTarget(
name: "WaitlistTests",
dependencies: ["Waitlist", "WaitlistMocks"])
dependencies: ["Waitlist", "WaitlistMocks"],
plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")]
)
]
)
Loading