firehol/netdata

View on GitHub
src/go/collectors/go.d.plugin/modules/weblog/collect.go

Summary

Maintainability
F
3 days
Test Coverage

WebLog has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

func (w *WebLog) logPanicStackIfAny() {
    err := recover()
    if err == nil {
        return
    }
Severity: Minor
Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go - About 3 hrs to fix

    Method WebLog.collectCustomFields has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (w *WebLog) collectCustomFields() {
        if !w.line.hasCustomFields() {
            return
        }
    
    
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go - About 2 hrs to fix

    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

    File collect.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // SPDX-License-Identifier: GPL-3.0-or-later
    
    package weblog
    
    import (
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go - About 2 hrs to fix

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

      func (w *WebLog) addDimToSSLCipherSuiteChart(cipher string) {
          chart := w.Charts().Get(reqBySSLCipherSuite.ID)
          if chart == nil {
              chart = reqBySSLCipherSuite.Copy()
              if err := w.Charts().Add(chart); err != nil {
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 2 hrs to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 443..462

      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 190.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToSSLProtoChart(proto string) {
          chart := w.Charts().Get(reqBySSLProto.ID)
          if chart == nil {
              chart = reqBySSLProto.Copy()
              if err := w.Charts().Add(chart); err != nil {
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 2 hrs to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 464..483

      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 190.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToURLPatternRespCodesChart(name, code string) {
          id := fmt.Sprintf(urlPatternRespCodes.ID, name)
          chart := w.Charts().Get(id)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", id)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 523..541

      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 171.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToURLPatternReqMethodsChart(name, method string) {
          id := fmt.Sprintf(urlPatternReqMethods.ID, name)
          chart := w.Charts().Get(id)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", id)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 503..521

      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 171.

      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 4 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToReqMethodChart(method string) {
          chart := w.Charts().Get(reqByMethod.ID)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", reqByMethod.ID)
              return
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 3 other locations - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 371..387
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 389..405
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 425..441

      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 154.

      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 4 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToPortChart(port string) {
          chart := w.Charts().Get(reqByPort.ID)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", reqByPort.ID)
              return
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 3 other locations - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 371..387
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 407..423
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 425..441

      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 154.

      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 4 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToVhostChart(vhost string) {
          chart := w.Charts().Get(reqByVhost.ID)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", reqByVhost.ID)
              return
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 3 other locations - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 389..405
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 407..423
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 425..441

      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 154.

      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 4 locations. Consider refactoring.
      Open

      func (w *WebLog) addDimToReqVersionChart(version string) {
          chart := w.Charts().Get(reqByVersion.ID)
          if chart == nil {
              w.Warningf("add dimension: no '%s' chart", reqByVersion.ID)
              return
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 3 other locations - About 1 hr to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 371..387
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 389..405
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 407..423

      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 154.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) collect() (map[string]int64, error) {
          defer w.logPanicStackIfAny()
          w.mx.reset()
      
          var mx map[string]int64
      Severity: Minor
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 50 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 33..45

      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 119.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) collectUpsRespTime() {
          if !w.line.hasUpsRespTime() {
              return
          }
          w.mx.UpsRespTime.Observe(w.line.upsRespTime)
      Severity: Minor
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 40 mins to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 244..253

      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 112.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) collectReqProcTime() {
          if !w.line.hasReqProcTime() {
              return
          }
          w.mx.ReqProcTime.Observe(w.line.reqProcTime)
      Severity: Minor
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 40 mins to fix
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 255..264

      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 112.

      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 2 locations. Consider refactoring.
      Open

      func (w *WebLog) logPanicStackIfAny() {
          err := recover()
          if err == nil {
              return
          }
      Severity: Minor
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 1 other location - About 40 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 17..31

      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 110.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectReqProto() {
          if !w.line.hasReqProto() {
              return
          }
          c, ok := w.mx.ReqVersion.GetP(w.line.reqProto)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 107..116
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 118..127
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 154..163
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 266..275
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 277..286

      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 105.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectPort() {
          if !w.line.hasPort() {
              return
          }
          c, ok := w.mx.ReqPort.GetP(w.line.port)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 107..116
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 154..163
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 266..275
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 277..286

      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 105.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectReqMethod() {
          if !w.line.hasReqMethod() {
              return
          }
          c, ok := w.mx.ReqMethod.GetP(w.line.reqMethod)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 107..116
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 118..127
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 266..275
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 277..286

      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 105.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectSSLProto() {
          if !w.line.hasSSLProto() {
              return
          }
          c, ok := w.mx.ReqSSLProto.GetP(w.line.sslProto)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 107..116
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 118..127
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 154..163
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 277..286

      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 105.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectVhost() {
          if !w.line.hasVhost() {
              return
          }
          c, ok := w.mx.ReqVhost.GetP(w.line.vhost)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 118..127
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 154..163
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 266..275
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 277..286

      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 105.

      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 10 locations. Consider refactoring.
      Open

      func (w *WebLog) collectSSLCipherSuite() {
          if !w.line.hasSSLCipherSuite() {
              return
          }
          c, ok := w.mx.ReqSSLCipherSuite.GetP(w.line.sslCipherSuite)
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/weblog/collect.go and 9 other locations - About 35 mins to fix
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 170..179
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 192..201
      src/go/collectors/go.d.plugin/modules/squidlog/collect.go on lines 203..212
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 107..116
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 118..127
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 154..163
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 181..190
      src/go/collectors/go.d.plugin/modules/weblog/collect.go on lines 266..275

      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 105.

      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