refactor(parser): remove unreachable duplicate priority check in step 5
All checks were successful
All checks were successful
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:
@@ -231,14 +231,8 @@ func ParseLine(line string) (Task, error) {
|
||||
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 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 dt, err := time.Parse(dateLayout, toks[i]); err == nil {
|
||||
t.CreationDate = &dt
|
||||
|
||||
Reference in New Issue
Block a user