Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Unsupported Regex Expressions #335

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Sources/XcbeautifyLib/CaptureGroups.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct CodesignCaptureGroup: CaptureGroup {

/// Regular expression captured groups:
/// $1 = file
static let regex = XCRegex(pattern: #"^CodeSign\s(((?!.framework/Versions/A)(?:\ |[^ ]))*?)( \(in target '.*' from project '.*' at path '.*'\))?$"#)
static let regex = XCRegex(pattern: #"^CodeSign\s(((?!.framework\/Versions\/A)(?:\ |[^ ]))*?)( \(in target '.*' from project '.*' at path '.*'\))?$"#)

let file: String

Expand All @@ -215,7 +215,7 @@ struct CodesignFrameworkCaptureGroup: CaptureGroup {

/// Regular expression captured groups:
/// $1 = file
static let regex = XCRegex(pattern: #"^CodeSign\s((?:\ |[^ ])*.framework)\/Versions/A"#)
static let regex = XCRegex(pattern: #"^CodeSign\s((?:\ |[^ ])*.framework)\/Versions\/A"#)

let frameworkPath: String

Expand Down Expand Up @@ -271,7 +271,7 @@ struct SwiftCompileCaptureGroup: CompileFileCaptureGroup {
/// $1 = file path
/// $2 = target
/// $3 = project
static let regex = XCRegex(pattern: #"^SwiftCompile \w+ \w+ ((?:\S|(?<=\\) )+) \(in target '(.*)' from project '(.*)'\)$"#)
static let regex = XCRegex(pattern: #"^SwiftCompile \w+ \w+ ((?!Compiling\\ ).*) \(in target '(.*)' from project '(.*)'\)$"#)

let filePath: String
let filename: String
Expand Down Expand Up @@ -362,8 +362,8 @@ struct CompileStoryboardCaptureGroup: CompileFileCaptureGroup {
struct CopyFilesCaptureGroup: CaptureGroup {
static let outputType: OutputType = .task

// ((?:\S|(?<=\\) )+) --> Match any non-whitespace character OR any escaped space (space in filename)
static let regex = XCRegex(pattern: #"^Copy ((?:\S|(?<=\\) )+) ((?:\S|(?<=\\) )+) \(in target '(.*)' from project '.*'\)$"#)
// ((?:\S|(?:\\ ))+) --> Match any non-whitespace character OR any escaped space (space in filename)
static let regex = XCRegex(pattern: #"^Copy ((?:\S|(?:\\ ))+) ((?:\S|(?:\\ ))+) \(in target '(.*)' from project '.*'\)$"#)

let firstFilePath: String
let firstFilename: String
Expand Down Expand Up @@ -912,7 +912,7 @@ struct ParallelTestCaseFailedCaptureGroup: CaptureGroup {
/// $2 = test case
/// $3 = installed app file and ID (e.g. "MyApp.app (12345)"), process (e.g. "xctest (12345)"), or device (e.g. "iPhone X")
/// $4 = time
static let regex = XCRegex(pattern: #"^Test\s+case\s+'(.*)[\./](.*)\(\)'\s+failed\s+on\s+'(.*)'\s+\((\d*\.(.*){3})\s+seconds\)"#)
static let regex = XCRegex(pattern: #"^Test\s+case\s+'(.*)[\.\/](.*)\(\)'\s+failed\s+on\s+'(.*)'\s+\((\d*\.(.*){3})\s+seconds\)"#)

let suite: String
let testCase: String
Expand Down Expand Up @@ -1061,7 +1061,7 @@ struct ProcessPchCommandCaptureGroup: CaptureGroup {

/// Regular expression captured groups:
/// $1 file path
static let regex = XCRegex(pattern: #"^\s*.*\/usr\/bin\/clang\s.*\s\-c\s(.*?)(?<!\\)\s.*\-o\s.*\.gch"#)
static let regex = XCRegex(pattern: #"^\s*.*\/usr\/bin\/clang\s.*\s\-c\s(.*)\s\-o\s.*\.gch"#)

let filePath: String

Expand Down Expand Up @@ -1391,7 +1391,7 @@ struct DuplicateLocalizedStringKeyCaptureGroup: CaptureGroup {

/// Regular expresion captured groups:
/// $1 = warning message.
static let regex = XCRegex(pattern: #"^[\d\s-:]+ --- WARNING: (Key ".*" used with multiple values. Value ".*" kept. Value ".*" ignored.)$"#)
static let regex = XCRegex(pattern: #"^[\d -:]+ --- WARNING: (Key ".*" used with multiple values. Value ".*" kept. Value ".*" ignored.)$"#)

let warningMessage: String

Expand Down Expand Up @@ -1660,7 +1660,7 @@ struct ModuleIncludesErrorCaptureGroup: ErrorCaptureGroup {

/// Regular expression captured groups:
/// $1 = error reason
static let regex = XCRegex(pattern: #"^\<module-includes\>:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$/"#)
static let regex = XCRegex(pattern: #"^\<module-includes\>:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$\/"#)

let wholeError: String

Expand Down Expand Up @@ -1843,7 +1843,7 @@ struct SwiftDriverJobDiscoveryCompilingCaptureGroup: CaptureGroup {
// $3 = filenames
// $4 = target
// $5 = project
static let regex = XCRegex(pattern: #"^SwiftDriverJobDiscovery (\S+) (\S+) Compiling ((?:\S|(?>, )|(?<=\\) )+) \(in target '(.*)' from project '(.*)'\)"#)
static let regex = XCRegex(pattern: #"^SwiftDriverJobDiscovery (\S+) (\S+) Compiling (.*) \(in target '(.*)' from project '(.*)'\)"#)

let state: String // Currently, the only expected/known value is `normal`
let architecture: String
Expand Down