Skip to content

Commit eb3cf3e

Browse files
AliSoftwaremokagio
andcommitted
Apply error reporting wording suggestions
#18525 (comment) #18525 (comment) Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com>
1 parent ea0d803 commit eb3cf3e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Scripts/BuildPhases/LintAppLocalizedStringsUsage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ ! -x "${LINTER_EXEC}" ] || ! (shasum -c "${LINTER_EXEC}.shasum" >/dev/null
1515
fi
1616

1717
if [ -z "${PROJECT_FILE_PATH:=${1:-}}" ]; then
18-
echo "Please provide the path to the xcodeproj to scan"
18+
echo "error: Please provide the path to the xcodeproj to scan"
1919
exit 1
2020
fi
2121
"$LINTER_EXEC" "${PROJECT_FILE_PATH}" "${@:2}"

Scripts/BuildPhases/LintAppLocalizedStringsUsage.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ extension Xcodeproj {
114114
var description: String {
115115
switch self {
116116
case .objectNotFound(id: let id):
117-
return "Unable to find object with UUID \(id)"
117+
return "Unable to find object with UUID `\(id)`"
118118
case .unexpectedObjectType(id: let id, expectedType: let expectedType, found: let found):
119-
return "Object with UUID \(id) was expected to be of type \(expectedType) but found \(found) instead"
119+
return "Object with UUID `\(id)` was expected to be of type \(expectedType) but found \(found) instead"
120120
case .incorrectAbsolutePath(id: let id):
121-
return "Object \(id) has `sourceTree = \(Xcodeproj.SourceTree.absolute)` but no `path`"
121+
return "Object `\(id)` has `sourceTree = \(Xcodeproj.SourceTree.absolute)` but no `path`"
122122
case .orphanObject(id: let id, object: let object):
123-
return "Unable to find parent group of \(object) (\(id)) during file path resolution"
123+
return "Unable to find parent group of \(object) (`\(id)`) during file path resolution"
124124
}
125125
}
126126
}
@@ -277,6 +277,7 @@ func lint(fileAt url: URL, targetName: String) throws -> LintResult {
277277
guard line.range(of: "\\s*//", options: .regularExpression) == nil else { return } // Skip commented lines
278278
guard let range = line.range(of: "NSLocalizedString") else { return }
279279

280+
// Violation found, report it
280281
let colNo = line.distance(from: line.startIndex, to: range.lowerBound)
281282
let message = "Use `AppLocalizedString` instead of `NSLocalizedString` in source files that are used in the `\(targetName)` extension target. See paNNhX-nP-p2 for more info."
282283
print("\(url.path):\(lineNo):\(colNo): error: \(message)")
@@ -320,6 +321,6 @@ do {
320321
print("Done! \(violationsFound) violation(s) found.")
321322
exit(violationsFound > 0 ? 1 : 0)
322323
} catch let error {
323-
print("\n\nError while parsing `\(projectPath)`: \(error)")
324+
print("\(projectPath): error: Error while parsing the project file \(projectPath): \(error.localizedDescription)")
324325
exit(2)
325326
}

0 commit comments

Comments
 (0)