refactor(parser): remove unreachable duplicate priority check in step 5
All checks were successful
Release Binaries / build (amd64, golang:1.24-alpine, linux/amd64, linux-amd64, apk add --no-cache upx) (release) Successful in 13s
Release Binaries / build (arm64, golang:1.24-alpine, linux/arm64, linux-arm64, apk add --no-cache upx zstd-static) (release) Successful in 16s

Step 4 already consumes the (X) priority token before step 5 runs, so
the identical check inside the `!t.Completed` block could never match.
No behavior change (verified against test.todo.txt).
This commit is contained in:
2026-07-09 23:57:16 +02:00
parent 096216579d
commit 72efcb13ba

View File

@@ -231,14 +231,8 @@ func ParseLine(line string) (Task, error) {
i++ i++
} }
// 5) If not completed, check for priority at start // 5) Creation date for incomplete tasks (priority, if any, was already consumed in step 4)
if !t.Completed { if !t.Completed {
if i < len(toks) && len(toks[i]) == 3 && toks[i][0] == '(' && toks[i][2] == ')' && toks[i][1] >= 'A' && toks[i][1] <= 'Z' {
r := rune(toks[i][1])
t.Priority = &r
i++
}
// Creation date for incomplete tasks
if i < len(toks) && dateRe.MatchString(toks[i]) { if i < len(toks) && dateRe.MatchString(toks[i]) {
if dt, err := time.Parse(dateLayout, toks[i]); err == nil { if dt, err := time.Parse(dateLayout, toks[i]); err == nil {
t.CreationDate = &dt t.CreationDate = &dt