netdata/netdata

View on GitHub
src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go

Summary

Maintainability
D
2 days
Test Coverage

Method NginxPlus.queryAvailableEndpoints has 65 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (n *NginxPlus) queryAvailableEndpoints() error {
    req, _ := web.NewHTTPRequest(n.Request.Copy())
    req.URL.Path = fmt.Sprintf(urlPathAPIEndpointsRoot, n.apiVersion)

    var endpoints []string

    Method NginxPlus.doWithDecode has 6 return statements (exceeds 4 allowed).
    Open

    func (n *NginxPlus) doWithDecode(dst interface{}, req *http.Request) error {
        n.Debugf("executing %s '%s'", req.Method, req.URL)
        resp, err := n.httpClient.Do(req)
        if err != nil {
            return err
    Severity: Major
    Found in src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go - About 40 mins to fix

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryHTTPRequests(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIHTTPRequests, n.apiVersion)
      
          var v nginxHTTPRequests
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryHTTPLocationZones(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIHTTPLocationZones, n.apiVersion)
      
          var v nginxHTTPLocationZones
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) querySSL(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPISSL, n.apiVersion)
      
          var v nginxSSL
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryHTTPServerZones(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIHTTPServerZones, n.apiVersion)
      
          var v nginxHTTPServerZones
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryStreamUpstreams(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIStreamUpstreams, n.apiVersion)
      
          var v nginxStreamUpstreams
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryNginxInfo(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPINginx, n.apiVersion)
      
          var v nginxInfo
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryHTTPUpstreams(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIHTTPUpstreams, n.apiVersion)
      
          var v nginxHTTPUpstreams
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryHTTPCaches(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIHTTPCaches, n.apiVersion)
      
          var v nginxHTTPCaches
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryResolvers(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIResolvers, n.apiVersion)
      
          var v nginxResolvers
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryConnections(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIConnections, n.apiVersion)
      
          var v nginxConnections
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 293..306
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

      func (n *NginxPlus) queryStreamServerZones(ms *nginxMetrics) {
          req, _ := web.NewHTTPRequest(n.Request.Copy())
          req.URL.Path = fmt.Sprintf(urlPathAPIStreamServerZones, n.apiVersion)
      
          var v nginxStreamServerZones
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 173..186
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 188..201
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 203..216
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 218..231
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 233..246
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 248..261
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 263..276
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 278..291
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 308..321
      src/go/collectors/go.d.plugin/modules/nginxplus/nginx_http_api_query.go on lines 323..336

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 161.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status