Add comments to linter exceptions

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2024-10-30 15:19:39 +00:00
parent afda9f3b97
commit 5624d2cbfd
1 changed files with 5 additions and 5 deletions

View File

@ -197,7 +197,7 @@ func completeDetachKeys(_ *cobra.Command, _ []string, _ string) ([]string, cobra
// The completion is partly composite. // The completion is partly composite.
func completeIpc(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func completeIpc(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic // not swapped, matches partly typed "container"
return []string{"container:"}, cobra.ShellCompDirectiveNoSpace return []string{"container:"}, cobra.ShellCompDirectiveNoSpace
} }
if strings.HasPrefix(toComplete, "container:") { if strings.HasPrefix(toComplete, "container:") {
@ -237,7 +237,7 @@ func completeLogOpt(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.S
// completePid implements shell completion for the `--pid` option of `run` and `create`. // completePid implements shell completion for the `--pid` option of `run` and `create`.
func completePid(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { func completePid(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic // not swapped, matches partly typed "container"
return []string{"container:"}, cobra.ShellCompDirectiveNoSpace return []string{"container:"}, cobra.ShellCompDirectiveNoSpace
} }
if strings.HasPrefix(toComplete, "container:") { if strings.HasPrefix(toComplete, "container:") {
@ -251,10 +251,10 @@ func completePid(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command
// completeSecurityOpt implements shell completion for the `--security-opt` option of `run` and `create`. // completeSecurityOpt implements shell completion for the `--security-opt` option of `run` and `create`.
// The completion is partly composite. // The completion is partly composite.
func completeSecurityOpt(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) { func completeSecurityOpt(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(toComplete) > 0 && strings.HasPrefix("apparmor=", toComplete) { //nolint:gocritic if len(toComplete) > 0 && strings.HasPrefix("apparmor=", toComplete) { //nolint:gocritic // not swapped, matches partly typed "apparmor="
return []string{"apparmor="}, cobra.ShellCompDirectiveNoSpace return []string{"apparmor="}, cobra.ShellCompDirectiveNoSpace
} }
if len(toComplete) > 0 && strings.HasPrefix("label", toComplete) { //nolint:gocritic if len(toComplete) > 0 && strings.HasPrefix("label", toComplete) { //nolint:gocritic // not swapped, matches partly typed "label"
return []string{"label="}, cobra.ShellCompDirectiveNoSpace return []string{"label="}, cobra.ShellCompDirectiveNoSpace
} }
if strings.HasPrefix(toComplete, "label=") { if strings.HasPrefix(toComplete, "label=") {
@ -265,7 +265,7 @@ func completeSecurityOpt(_ *cobra.Command, _ []string, toComplete string) ([]str
return prefixWith("label=", labels), cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp return prefixWith("label=", labels), cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp
} }
// length must be > 1 here so that completion of "s" falls through. // length must be > 1 here so that completion of "s" falls through.
if len(toComplete) > 1 && strings.HasPrefix("seccomp", toComplete) { //nolint:gocritic if len(toComplete) > 1 && strings.HasPrefix("seccomp", toComplete) { //nolint:gocritic // not swapped, matches partly typed "seccomp"
return []string{"seccomp="}, cobra.ShellCompDirectiveNoSpace return []string{"seccomp="}, cobra.ShellCompDirectiveNoSpace
} }
if strings.HasPrefix(toComplete, "seccomp=") { if strings.HasPrefix(toComplete, "seccomp=") {