Add SwiftLint HARD rules
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2025-04-30 17:05:02 +02:00
parent c3445042b7
commit 279f13dbd5
79 changed files with 1969 additions and 1384 deletions

View File

@ -7,36 +7,36 @@
import Foundation
class ImageFileParser {
enum ImageFileParser {
static func parse(_ inputFile: String, platform: PlatormTag) -> [ParsedImage] {
let inputFileContent = try! String(contentsOfFile: inputFile, encoding: .utf8)
let inputFileContent = try! String(contentsOfFile: inputFile, encoding: .utf8) // swiftlint:disable:this force_try
let stringsByLines = inputFileContent.components(separatedBy: .newlines)
return Self.parseLines(stringsByLines, platform: platform)
}
static func parseLines(_ lines: [String], platform: PlatormTag) -> [ParsedImage] {
var imagesToGenerate = [ParsedImage]()
lines.forEach {
guard $0.removeLeadingTrailingWhitespace().isEmpty == false, $0.first != "#" else {
return
}
let splittedLine = $0.split(separator: " ")
let width: Int = {
if splittedLine[2] == "?" {
return -1
}
return Int(splittedLine[2])!
return Int(splittedLine[2])! // swiftlint:disable:this force_unwrapping
}()
let height: Int = {
if splittedLine[3] == "?" {
return -1
}
return Int(splittedLine[3])!
return Int(splittedLine[3])! // swiftlint:disable:this force_unwrapping
}()
var imageExtensions: [ImageExtension] = []