From 46c2182adea292289aacb2b74ba6f44003b0f53a Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 31 Oct 2017 12:24:31 +0100 Subject: [PATCH 1/2] fix linting by using new maligned linter instead of aligncheck upstream switched the alignment check backend and in doing so fails to run if the old backend is defined in the config. also skip alignment linting on a struct we use for byte decoding as we have no choice in its member order. --- deb/remote.go | 2 +- linter.json | 2 +- utils/config.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deb/remote.go b/deb/remote.go index ac1cb1517c..5c365c9745 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -592,7 +592,7 @@ func (repo *RemoteRepo) Decode(input []byte) error { if err != nil { if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") { // probably it is broken DB from go < 1.2, try decoding w/o time.Time - var repo11 struct { + var repo11 struct { // nolint: maligned UUID string Name string ArchiveRoot string diff --git a/linter.json b/linter.json index 37a3256721..2f221d88d5 100644 --- a/linter.json +++ b/linter.json @@ -12,7 +12,7 @@ "staticcheck", "varcheck", "structcheck", - "aligncheck", + "maligned", "vetshadow", "goconst", "interfacer" diff --git a/utils/config.go b/utils/config.go index 39333d343d..01b792cef6 100644 --- a/utils/config.go +++ b/utils/config.go @@ -7,7 +7,7 @@ import ( ) // ConfigStructure is structure of main configuration -type ConfigStructure struct { // nolint: aligncheck +type ConfigStructure struct { // nolint: maligned RootDir string `json:"rootDir"` DownloadConcurrency int `json:"downloadConcurrency"` DownloadLimit int64 `json:"downloadSpeedLimit"` From f43801cb9635c7edc61028241887972827f4d3c2 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 31 Oct 2017 12:42:11 +0100 Subject: [PATCH 2/2] whitelist falke E722 in system/lib.py 'E722 do not use bare except' wants us not to use except without type restriction as it catches everything and the kitchen sink. Since we use them to catch exceptions in test cases this is intentional as we implement general purpose error handling on test failure there. --- system/lib.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/lib.py b/system/lib.py index 90727b378d..8fd0c204ca 100644 --- a/system/lib.py +++ b/system/lib.py @@ -194,7 +194,7 @@ def get_gold(self, gold_name="gold"): def check_output(self): try: self.verify_match(self.get_gold(), self.output, match_prepare=self.outputMatchPrepare) - except: + except: # noqa: E722 if self.captureResults: if self.outputMatchPrepare is not None: self.output = self.outputMatchPrepare(self.output) @@ -207,7 +207,7 @@ def check_cmd_output(self, command, gold_name, match_prepare=None, expected_code output = self.run_cmd(command, expected_code=expected_code) try: self.verify_match(self.get_gold(gold_name), output, match_prepare) - except: + except: # noqa: E722 if self.captureResults: if match_prepare is not None: output = match_prepare(output) @@ -228,7 +228,7 @@ def check_file_contents(self, path, gold_name, match_prepare=None): try: self.verify_match(self.get_gold(gold_name), contents, match_prepare=match_prepare) - except: + except: # noqa: E722 if self.captureResults: if match_prepare is not None: contents = match_prepare(contents) @@ -241,7 +241,7 @@ def check_file(self): contents = open(self.checkedFile, "r").read() try: self.verify_match(self.get_gold(), contents) - except: + except: # noqa: E722 if self.captureResults: with open(self.get_gold_filename(), "w") as f: f.write(contents)