From 3adf5ce1e1f2dfa69525d8bbdb8a24186cda705f Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 28 Nov 2014 15:21:56 -0800 Subject: [PATCH] fix(linja): incorrect output when maximum number of errors/warnings was reached, fixes #352 --- bin/linja | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/linja b/bin/linja index caa04e000..63983d5b6 100755 --- a/bin/linja +++ b/bin/linja @@ -104,6 +104,8 @@ class FlycheckItemList: self.items = filter(pred, self.items) def append(self, item): self.items.append(item) + def truncate(self, n): + del self.items[n:] def removeExtraItemsStartswith(self, text): self.sort() newItems = self.items[:1] @@ -407,7 +409,7 @@ def process_lean_output(target, out, args): # Add tooManyItemsError at the end if we truncated the list if n and len(flycheckItemList) > n: count = len(flycheckItemList) - flycheckItemList = flycheckItemList[:n] + flycheckItemList.truncate(n) tooManyItemsError = FlycheckItem(target, 1, 0, "error", "For performance, we only display %d errors/warnings out of %d. (lean-flycheck-max-messages-to-display)" % (n, count)) flycheckItemList.append(tooManyItemsError) print flycheckItemList