Repository navigation
refactor: simplify code churned through 0.10.0 - #442
Merged
Merged
Conversation
…alue badImportDates and futureImportDates become importDates, which parses each date attribute once.
Each refused item keeps its lines by kind, so reason(), Error() and the blocked list loop over the table instead of naming ten fields in lockstep.
The other-items paragraph now checks for an item that does not fail directly; the missing, dropped and misfiled sets are disjoint, so this is the same test as the count comparison.
importCreates trims the title once and uses it for the project and heading bookkeeping as well as the create.
The lookups, notes and warnings move from closures in resolveImportDests to methods, the to-do and project cases become taskDest and projectDest, and the heading-id branch becomes headingIDDest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanups from a /simplify sweep over the code that changed between v0.9.0 and HEAD. Everything is meant to keep behaviour the same: no command, flag, output, error text or exit code changes, and no golden or testdata files changed.
make testandmake lintpass.Import
Error()text and--jsonitems match the old code byte for byte.resolveImportDestsbecomes adestResolverstruct with small methods.problemstype replaces the parallel lines/names slices; onejsonTexthelper replaces sixjson.Marshalcopies.not-found,ambiguous, ...) are named constants, including theunconfirmedMsgkeys.createdWhereandconfirmedRowreplace duplicated filter and lookup loops.Other commands
applyEdit;applyStatusWriteandverifyStatusare gone.runEditinlines two single-use wrappers for the "changed" test.knownHeadingID,Deps.dbPath, and one branch foropen's--projectand positional ref.internal/db
notATemplate; the comment saying it couldn't was wrong.widensStatusnames the status widening rule once;foldsUnloggedis an argument rather than an option no caller set.FoldTag/foldAreaRef,queryAllfor checklist items,untrashedRows;scanProjectdrops a dead NULL guard.output / things / config
lipgloss.JoinHorizontal; the compact date is only built on a TTY.ThingsDate.Date()shared byToTimeanddaysFromToday;styledProjectIconreusesstyledStatus.setNonEmpty/setBoolreuse, a package-level AppleScript escaper, a shared length check, a shared config bool lookup.Skipped
GetTask's substring step from the folded candidates: not equivalent for NULL status/trashed rows or an empty reference.dbtest.RecurrenceintoRepeats: db tests call it directly.runEdit's parameters, sharing thetag addloop, splittingtasks.go: not worth it.