Method MetricsSpecification.getCloudFoundryMetrics
has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring. Open
func (m *MetricsSpecification) getCloudFoundryMetrics(c echo.Context) error {
userGUID, err := m.portalProxy.GetSessionStringValue(c, "user_id")
if err != nil {
return errors.New("Could not find session user_id")
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function makePrometheusRequestURI
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
func makePrometheusRequestURI(c echo.Context, prometheusOp string, modify string) *url.URL {
uri := getEchoURL(c)
uri.Path = "/api/v1/" + prometheusOp
values := uri.Query()
query := values.Get("query")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function makePrometheusRequestInfos
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func makePrometheusRequestInfos(c echo.Context, userGUID string, metrics map[string]EndpointMetricsRelation, prometheusOp string, queries string, addJob bool) []interfaces.ProxyRequestInfo {
Function makePrometheusRequestInfos
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func makePrometheusRequestInfos(c echo.Context, userGUID string, metrics map[string]EndpointMetricsRelation, prometheusOp string, queries string, addJob bool) []interfaces.ProxyRequestInfo {
// Construct the metadata for proxying
requests := make([]interfaces.ProxyRequestInfo, 0)
for _, metric := range metrics {
req := interfaces.ProxyRequestInfo{}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"