Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
studiosutara committed Dec 6, 2024
1 parent f3e2b98 commit e6a31c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public class ContentBlockerRulesManager: CompiledRuleListsSource {
Logger.contentBlocking.debug("Failed to complete task \(task.rulesList.name, privacy: .public)")
return nil
}

let rules = Rules(compilationResult: result)

let diff: ContentBlockerRulesIdentifier.Difference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import TrackerRadarKit
import os.log

extension ContentBlockerRulesManager {

internal struct CompilationResult {
let compiledRulesList: WKContentRuleList
let model: ContentBlockerRulesSourceModel
Expand All @@ -34,14 +34,13 @@ extension ContentBlockerRulesManager {
let compilationTime: TimeInterval
let iterationCount: Int
}

enum ResultType {
case cacheLookup
case rulesCompilation
}
}



/**
Encapsulates compilation steps for a single Task
*/
Expand Down Expand Up @@ -109,11 +108,11 @@ extension ContentBlockerRulesManager {
model: ContentBlockerRulesSourceModel,
resultType: CompilationResult.ResultType,
completionHandler: @escaping Completion) {

self.result = self.getCompilationResult(ruleList: compiledRulesList,
model: model,
resultType: resultType)

workQueue.async {
completionHandler(self, true)
}
Expand Down Expand Up @@ -174,7 +173,7 @@ extension ContentBlockerRulesManager {
}
}
}

func getCompilationResult(ruleList: WKContentRuleList,
model: ContentBlockerRulesSourceModel,
resultType: CompilationResult.ResultType) -> CompilationResult {
Expand All @@ -189,15 +188,15 @@ extension ContentBlockerRulesManager {
model: model,
resultType: resultType,
performanceInfo: perfInfo)

}

func getCompilationRetryCount() -> Int {
guard let brokenSources = sourceManager.brokenSources else {
// if none of the sources are broken, we do not do any retries
return 0
}

let identifiers = [
brokenSources.allowListIdentifier,
brokenSources.tempListIdentifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class ContentBlockerRulesManagerLoadingTests: ContentBlockerRulesManagerTests {

} else if case .contentBlockingLRCMissing = event {
lookupAndFetchExp.fulfill()
} else if case .contentBlockingCompilationTaskPerformance(let retryCount, _) = event {
} else if case .contentBlockingCompilationTaskPerformance(let retryCount, _) = event {
XCTAssertEqual(retryCount, 0)
} else {
XCTFail("Unexpected event: \(event)")
Expand Down Expand Up @@ -644,7 +644,7 @@ class ContentBlockerRulesManagerLoadingTests: ContentBlockerRulesManagerTests {
XCTFail("Unexpected component: \(component)")
}

}else if case .contentBlockingCompilationTaskPerformance(let retryCount, _) = event {
} else if case .contentBlockingCompilationTaskPerformance(let retryCount, _) = event {
XCTAssertEqual(retryCount, 3)
} else if case .contentBlockingLRCMissing = event {
lookupAndFetchExp.fulfill()
Expand Down

0 comments on commit e6a31c7

Please sign in to comment.