Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions internal/query/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

// queryFeatureFlag gates the command while it is in Open Preview, following the
// same Hidden-until-targeted pattern as other preview commands (see
// internal/unified-stream-manager/command.go).
// internal/network/command_access_point_private_link_ingress_endpoint.go).
queryFeatureFlag = "cli.query"
)

Expand All @@ -68,9 +68,9 @@
"This command is in Open Preview and may change in a backward-incompatible way in a minor release.",
Args: cobra.MaximumNArgs(1),
// Hidden until the org is targeted by the flag, matching how other
// Open-Preview-only commands gate visibility (e.g. unified-stream-manager).
// cfg.IsTest keeps it visible to the integration suite regardless of the
// (unreachable, in tests) LaunchDarkly evaluation.
// Open-Preview-only commands gate visibility (e.g. the private link ingress
// endpoint command). cfg.IsTest keeps it visible to the integration suite
// regardless of the (unreachable, in tests) LaunchDarkly evaluation.
Hidden: !(cfg.IsTest || featureflags.Manager.BoolVariation(queryFeatureFlag, cfg.Context(), cliconfig.CliLaunchDarklyClient, true, false)),
Annotations: map[string]string{
pcmd.RunRequirement: pcmd.RequireNonAPIKeyCloudLogin,
Expand Down Expand Up @@ -190,7 +190,7 @@
Incomplete bool `json:"incomplete" yaml:"incomplete"`
}

func (c *command) runQuery(cmd *cobra.Command, args []string) error {

Check failure on line 193 in internal/query/command.go

View check run for this annotation

SonarQube-Confluent / SonarQube Code Analysis

Refactor this method to reduce its Cognitive Complexity from 33 to the 15 allowed.

[S3776] Cognitive Complexity of functions should not be too high See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3466&issues=963b3239-2463-45dd-a9eb-f90bd0f6df91&open=963b3239-2463-45dd-a9eb-f90bd0f6df91
environmentId, err := c.Context.EnvironmentId()
if err != nil {
return err
Expand Down Expand Up @@ -241,15 +241,15 @@
return err
}
if maxRows < 0 {
return errors.New(`the "--max-rows" flag must not be negative`)
return errors.New("the `--max-rows` flag must not be negative")
}

raw, err := cmd.Flags().GetBool("raw")
if err != nil {
return err
}
if raw && !output.GetFormat(cmd).IsSerialized() {
return errors.New(`the "--raw" flag requires "-o json" or "-o yaml"`)
return errors.New("the `--raw` flag requires `-o json` or `-o yaml`")
}

statementProperties, err := c.buildQueryProperties(cmd, environment.GetDisplayName(), database)
Expand Down Expand Up @@ -419,7 +419,7 @@
}
return errors.NewErrorWithSuggestions(
fmt.Sprintf(`query %s before statement "%s" finished`, reason, name),
fmt.Sprintf("Check the statement with `confluent flink statement describe %s`, or raise the limit with the \"--timeout\" flag.", name),
fmt.Sprintf("Check the statement with `confluent flink statement describe %s`, or raise the limit with the `--timeout` flag.", name),
)
}

Expand Down Expand Up @@ -506,7 +506,7 @@
}
}

func (c *command) printQueryResult(cmd *cobra.Command, name string, result *query.Result, showOperation, raw bool) error {

Check failure on line 509 in internal/query/command.go

View check run for this annotation

SonarQube-Confluent / SonarQube Code Analysis

Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.

[S3776] Cognitive Complexity of functions should not be too high See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3466&issues=9b81af85-400a-492f-bdef-adf0056104ac&open=9b81af85-400a-492f-bdef-adf0056104ac
columns := make([]queryColumnOut, len(result.Columns))
headers := make([]string, len(result.Columns))
for i, column := range result.Columns {
Expand Down
Loading
Loading