From 82eda48066fdf16a55795ec4d9bcd3f5efc95910 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 24 Jun 2025 16:19:42 +0200 Subject: [PATCH] cli/connhelper/internal/syntax: fix linting issues cli/connhelper/internal/syntax/parser.go:31:2: Duplicate words (the) found (dupword) // Note that it shares some features with Bash, due to the the shared ^ cli/connhelper/internal/syntax/quote.go:48:1: cyclomatic complexity 35 of func `Quote` is high (> 16) (gocyclo) func Quote(s string, lang LangVariant) (string, error) { ^ cli/connhelper/internal/syntax/quote.go:103:3: shadow: declaration of "offs" shadows declaration at line 56 (govet) offs := 0 ^ Signed-off-by: Sebastiaan van Stijn --- cli/connhelper/internal/syntax/parser.go | 2 +- cli/connhelper/internal/syntax/quote.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/connhelper/internal/syntax/parser.go b/cli/connhelper/internal/syntax/parser.go index d0382299fb..06b1222f43 100644 --- a/cli/connhelper/internal/syntax/parser.go +++ b/cli/connhelper/internal/syntax/parser.go @@ -24,7 +24,7 @@ const ( // LangMirBSDKorn corresponds to the MirBSD Korn Shell, also known as // mksh, as described at http://www.mirbsd.org/htman/i386/man1/mksh.htm. - // Note that it shares some features with Bash, due to the the shared + // Note that it shares some features with Bash, due to the shared // ancestry that is ksh. // // We currently follow mksh version 59. diff --git a/cli/connhelper/internal/syntax/quote.go b/cli/connhelper/internal/syntax/quote.go index 6f27eba12d..628fa4891c 100644 --- a/cli/connhelper/internal/syntax/quote.go +++ b/cli/connhelper/internal/syntax/quote.go @@ -45,6 +45,8 @@ const ( // // Some strings do not require any quoting and are returned unchanged. // Those strings can be directly surrounded in single quotes as well. +// +//nolint:gocyclo // ignore "cyclomatic complexity 35 of func `Quote` is high (> 16) (gocyclo)" func Quote(s string, lang LangVariant) (string, error) { if s == "" { // Special case; an empty string must always be quoted, @@ -100,7 +102,7 @@ func Quote(s string, lang LangVariant) (string, error) { if nonPrintable { b.WriteString("$'") lastRequoteIfHex := false - offs := 0 + offs = 0 for rem := s; len(rem) > 0; { nextRequoteIfHex := false r, size := utf8.DecodeRuneInString(rem)