diff --git a/Sources/SwiftPolyglot/SwiftPolyglot.swift b/Sources/SwiftPolyglot/SwiftPolyglot.swift index c66e52e..df12d86 100755 --- a/Sources/SwiftPolyglot/SwiftPolyglot.swift +++ b/Sources/SwiftPolyglot/SwiftPolyglot.swift @@ -22,7 +22,7 @@ struct SwiftPolyglot: ParsableCommand { filePaths: filePaths, languageCodes: languages, logsErrorOnMissingTranslation: errorOnMissing, - runningOnAGitHubAction: ProcessInfo.processInfo.environment["GITHUB_ACTIONS"] == "true" + isRunningInAGitHubAction: ProcessInfo.processInfo.environment["GITHUB_ACTIONS"] == "true" ) do { diff --git a/Sources/SwiftPolyglotCore/SwiftPolyglotCore.swift b/Sources/SwiftPolyglotCore/SwiftPolyglotCore.swift index a46ee12..79a5bdd 100644 --- a/Sources/SwiftPolyglotCore/SwiftPolyglotCore.swift +++ b/Sources/SwiftPolyglotCore/SwiftPolyglotCore.swift @@ -4,13 +4,18 @@ public struct SwiftPolyglotCore { private let filePaths: [String] private let languageCodes: [String] private let logsErrorOnMissingTranslation: Bool - private let runningOnAGitHubAction: Bool + private let isRunningInAGitHubAction: Bool - public init(filePaths: [String], languageCodes: [String], logsErrorOnMissingTranslation: Bool, runningOnAGitHubAction: Bool) { + public init( + filePaths: [String], + languageCodes: [String], + logsErrorOnMissingTranslation: Bool, + isRunningInAGitHubAction: Bool + ) { self.filePaths = filePaths self.languageCodes = languageCodes self.logsErrorOnMissingTranslation = logsErrorOnMissingTranslation - self.runningOnAGitHubAction = runningOnAGitHubAction + self.isRunningInAGitHubAction = isRunningInAGitHubAction } public func run() throws { @@ -75,7 +80,7 @@ public struct SwiftPolyglotCore { let jsonDict = jsonObject as? [String: Any], let strings = jsonDict["strings"] as? [String: [String: Any]] else { - if runningOnAGitHubAction { + if isRunningInAGitHubAction { print("::warning file=\(fileURL.path)::Could not process file at path: \(fileURL.path)") } else { print("Could not process file at path: \(fileURL.path)") @@ -155,7 +160,7 @@ public struct SwiftPolyglotCore { } private func logWarning(file: String, message: String) { - if runningOnAGitHubAction { + if isRunningInAGitHubAction { if logsErrorOnMissingTranslation { print("::error file=\(file)::\(message)") } else { diff --git a/Tests/SwiftPolyglotCoreTests/SwiftPolyglotCoreTests.swift b/Tests/SwiftPolyglotCoreTests/SwiftPolyglotCoreTests.swift index 888a2ce..213b1f4 100644 --- a/Tests/SwiftPolyglotCoreTests/SwiftPolyglotCoreTests.swift +++ b/Tests/SwiftPolyglotCoreTests/SwiftPolyglotCoreTests.swift @@ -18,7 +18,7 @@ final class SwiftPolyglotCoreTests: XCTestCase { filePaths: [stringCatalogFilePath], languageCodes: ["ca", "de", "en", "es"], logsErrorOnMissingTranslation: false, - runningOnAGitHubAction: false + isRunningInAGitHubAction: false ) XCTAssertNoThrow(try swiftPolyglot.run()) @@ -40,7 +40,7 @@ final class SwiftPolyglotCoreTests: XCTestCase { filePaths: [stringCatalogFilePath], languageCodes: ["ca", "de", "en", "es"], logsErrorOnMissingTranslation: false, - runningOnAGitHubAction: false + isRunningInAGitHubAction: false ) XCTAssertNoThrow(try swiftPolyglot.run()) @@ -62,7 +62,7 @@ final class SwiftPolyglotCoreTests: XCTestCase { filePaths: [stringCatalogFilePath], languageCodes: ["ca", "de", "en", "es"], logsErrorOnMissingTranslation: true, - runningOnAGitHubAction: false + isRunningInAGitHubAction: false ) XCTAssertThrowsError(try swiftPolyglot.run()) @@ -84,7 +84,7 @@ final class SwiftPolyglotCoreTests: XCTestCase { filePaths: [stringCatalogFilePath], languageCodes: ["de, en"], logsErrorOnMissingTranslation: true, - runningOnAGitHubAction: false + isRunningInAGitHubAction: false ) XCTAssertThrowsError(try swiftPolyglot.run())