Skip to content

Commit

Permalink
Rename property
Browse files Browse the repository at this point in the history
  • Loading branch information
pereBohigas committed Apr 1, 2024
1 parent 90fad64 commit 2150d25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Sources/SwiftPolyglot/SwiftPolyglot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 10 additions & 5 deletions Sources/SwiftPolyglotCore/SwiftPolyglotCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)")
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions Tests/SwiftPolyglotCoreTests/SwiftPolyglotCoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -84,7 +84,7 @@ final class SwiftPolyglotCoreTests: XCTestCase {
filePaths: [stringCatalogFilePath],
languageCodes: ["de, en"],
logsErrorOnMissingTranslation: true,
runningOnAGitHubAction: false
isRunningInAGitHubAction: false
)

XCTAssertThrowsError(try swiftPolyglot.run())
Expand Down

0 comments on commit 2150d25

Please sign in to comment.