aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-10-16 12:05:25 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-19 10:19:19 +0200
commitebcd6fcea1517b00153214e3284d6307809175f5 (patch)
tree654bb83820741ea5bf279f13aef60aabdde8fb07 /worker
parentb22639ab20a329026d41e90f03a153c3e49c1b4c (diff)
downloadaerc-ebcd6fcea1517b00153214e3284d6307809175f5.tar.gz
lint: check for bad white space habits
A little coding hygiene cannot hurt. Add a simple awk script to check all source files for bad white space habits: - trailing white space - trailing new lines at the end of files - missing new line at the end of files - spaces followed by tabs The script outputs color when the terminal supports it. It exits with a non-zero code when there was at least one white space issue found. Call the script in the lint step. Example output of the awk script: config/default_styleset:1:# <-- trailing whitespace config/default_styleset:3:# <-- trailing whitespace doc/aerc.1.scd:78: Executes an arbitrary command in the background. Aerc will set the <-- trailing whitespace doc/aerc.1.scd:234: <-- trailing whitespace doc/aerc.1.scd:237: <-- trailing whitespace worker/types/thread_test.go:74: // return ErrSkipThread<-- space(s) followed by tab(s) worker/lib/testdata/message/invalid/hexa: trailing new line(s) Fix issues reported by the script. NB: The ENDFILE match is a GNU extension. It will be ignored on BSD-awk and trailing new lines will not be detected. The lint make target is only invoked on alpine linux which has GNU awk anyway. NB: Empty cells in scdoc tables require trailing white space... Avoid this by setting content in these cells. I don't really see a use for empty cells. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'worker')
-rw-r--r--worker/lib/testdata/message/invalid/hexa2
-rw-r--r--worker/notmuch/worker.go5
-rw-r--r--worker/types/thread_test.go3
3 files changed, 0 insertions, 10 deletions
diff --git a/worker/lib/testdata/message/invalid/hexa b/worker/lib/testdata/message/invalid/hexa
index 2967a198..56b352ff 100644
--- a/worker/lib/testdata/message/invalid/hexa
+++ b/worker/lib/testdata/message/invalid/hexa
@@ -24,5 +24,3 @@ Content-Type: text/html; charset=utf-8
<ObJECT>
--Nextpart_1Q2YJhd197991794467076Pgfa--
-
-
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index f1533e12..38539df5 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -135,18 +135,13 @@ func (w *worker) handleMessage(msg types.WorkerMessage) error {
case *types.CheckMail:
go w.handleCheckMail(msg)
return nil
-
// not implemented, they are generally not used
// in a notmuch based workflow
// case *types.DeleteMessages:
// case *types.CopyMessages:
- // return w.handleCopyMessages(msg)
// case *types.AppendMessage:
- // return w.handleAppendMessage(msg)
// case *types.CreateDirectory:
- // return w.handleCreateDirectory(msg)
// case *types.RemoveDirectory:
- // return w.handleRemoveDirectory(msg)
}
return errUnsupported
}
diff --git a/worker/types/thread_test.go b/worker/types/thread_test.go
index 803f7ba9..b3c39322 100644
--- a/worker/types/thread_test.go
+++ b/worker/types/thread_test.go
@@ -70,9 +70,6 @@ func TestNewWalk(t *testing.T) {
var prefix []string
lastLevel := 0
tree.Walk(func(t *Thread, lvl int, e error) error {
- // if t.Uid%2 != 0 {
- // return ErrSkipThread
- // }
if e != nil {
fmt.Printf("ERROR: %v\n", e)
}